Default namespace problem

Hi all,
I’m working with Tamino 4.1.4.1, I’m migrating from 3.1.2.1 and I have a problem with default namespaces in my doctype.

Here is a sample of schema:
<xs:schema xmlns:tsd = “http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition” xmlns:xs = “XML Schema”>
xs:annotation
xs:appinfo
<tsd:schemaInfo name = “base”>
<tsd:collection name = “base”></tsd:collection>
<tsd:doctype name = “base”>
tsd:logical
tsd:contentclosed</tsd:content>
</tsd:logical>
</tsd:doctype>
</tsd:schemaInfo>
</xs:appinfo>
</xs:annotation>
<xs:element name = “base”>
xs:complexType
<xs:choice minOccurs = “0” maxOccurs = “unbounded”>
<xs:element name = “first” type = “xs:string”></xs:element>
<xs:element name = “second” type = “xs:string”></xs:element>
<xs:element name = “third” type = “xs:string”></xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

and here is a sample of xml instance


ciao
hello
bye


The problem rises when I try to insert the xml instance in Tamino, if I remove the default namespace declaration all works good, if I leave xmlns as is in the example Tamino return a 7935 error.

Any ideas?
Thanks a lot,

GabriXML

Did you validate the schema and the instance? I tried http://apps.gotdotnet.com/xmltools/xsdvalidator/ and received an error message about the namespaces. Maybe the validator really checks the URL for validation???

Hello there!

The error INOXDE7935 indicates that the referenced schema does not exist.

Given that the insert works without the namespace, I would say that the problem is in the schema: the default namespace definition is probably missing.

I hope that helps,
Trevor.

Your schema describes an element with local name “base” in the null namespace, whereas your instance document has an element with local name “base” in the namespace “http://www.myurl.com/namespaces”. There’s no connection between these two names - names in one namespace are quite unrelated to names in a different namespace.

Michael Kay

Thanks everybody a lot,
now I understood, the schema doesn’t declare default namespace.
I tried to modify it and I got this:

<xs:schema targetNamespace = “http://www.myurl.com/namespaces” xmlns = “http://www.myurl.com/namespaces” xmlns:tsd = “http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition” xmlns:xs = “XML Schema”>
xs:annotation
xs:appinfo
<tsd:schemaInfo name = “base”>
<tsd:collection name = “base”></tsd:collection>
<tsd:doctype name = “base”>
tsd:logical
tsd:contentopen</tsd:content>
</tsd:logical>
</tsd:doctype>
</tsd:schemaInfo>
</xs:appinfo>
</xs:annotation>
<xs:element name = “base”>
xs:complexType
<xs:choice minOccurs = “0” maxOccurs = “unbounded”>
<xs:element name = “first” type = “xs:string”></xs:element>
<xs:element name = “second” type = “xs:string”></xs:element>
<xs:element name = “third” type = “xs:string”></xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

Now I haven’t error on insert, base instance is correctly stored on Tamino. But when I try to retrieve base element I get no result, I try using x-query “base”.
If I try x-query “*” I get all “base” element stored.
Maybe I’m a bit confused about namespaces, can you explain me this Tamino behaviour?

Thanks again,
Gx

Hello Gx,

I think that Michael’s previous explanation covers this situation too.
If the documents have elements whose names are qualified with a namespace, you need to specify that namespace in the query to retrieve them.

(If you use the unqualified name “base” in a query, you are implicitly referring to the “base” in the null namespace - but in this case you need to refer to the “base” that is in the “http://www.myurl.com/namespaces” namespace.)

I think that the easiest way to do this will be to add a namespace prefix definition to your schema (something like xmlns:gxl=“http://www.myurl.com/namespaces” for example), then use the defined prefix in the query (i.e. “/gxl:base”).

I hope that helps,
Trevor.

Ciao GabriXml
using your second schema you can query your document with following queries:

XQuery:

let $a := input()/*[local-name(.) = "base"]
return $a 
</pre><BR><BR><B>X-Query</B><BR><BR><pre class="ip-ubbcode-code-pre"> 
/*[local-name(.) = "base"]



I hope this can help.
Regards
Lorenzo