I downloaded XML example files and Schemas from HR-XML Consortium and tried to define them on Tamino. I?ve had some difficult with namespaces.
For the following Enrollment Document:
<?xml version="1.0" encoding="UTF-8"?>
??..
I?ve experienced the following:
If Tamino Schema has the http://ns.hr-xml.org as target namespace, I can load the document, but I can?t query this with x-query ?/Enrollment?, I can query the entire collection with x-query ?/? and the document is there. The xquery ?for $b in input() /Enrollment return $b? don?t read and ?for $b in input() /* return $b? read.
If Tamino Schema has no target namespace, I can?t load the original document (error Failed to locate schema for doctype ‘Enrollment’ in collection ‘HR’), I can load a document without namespaces references. (<?xml version="1.0" encoding="UTF-8"?>
?.)
How is the best way to manage namespaces in Tamino.
I use the Tamino Schema Converter (inoxsdconv) to generate TSD schemas. Attached are examples of them, and the xml files.
Files.zip (31.2 KB)
I found the documentation about it.
X-Query (XQL) do not support namespace declaration but I can use it in Xquery.
The following query runs fine.
declare namespace x=“http://ns.hr-xml.org”
for $b in input() /x:Enrollment
return $b
But the following is not allowed
default element namespace=“http://ns.hr-xml.org”
for $b in input() /Enrollment
return $b
response: <ino:messagetext ino:code=“INOXQE6368”>Default Element Namespaces are not allowed</ino:messagetext>
Documentation:
Qualified queries
The questions, however, is: How do we qualify element and attribute names within queries? How do we set up namespace bindings in a query (or in an update or insert operation)? The answer depends on the query language used: