Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is Oxygen generating child elements with empty xmlns attributes?
    primarykey
    data
    text
    <p>I am trying to grasp the technical side of working with the default namespace, when starting with a schema (developing one) and considering a realistic and correct corresponding XML file.</p> <p>I am using Oxygen to design the schema. </p> <p>Ideally, I would like that the user of the XML files do not have to deal with the default namespace (because they are painful, when trying to use XPath on documents which have declared the default namespace). However, from what I read so far, it seems that is not possible?</p> <p>My example schema looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.com/" xmlns="http://www.example.com/"&gt; &lt;xs:element name="QueryResponse"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element ref="Result"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:element name="Result"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element ref="Patient"/&gt; &lt;/xs:sequence&gt; &lt;xs:attribute name="type" type="xs:NCName"/&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:element name="VisitNumber" type="xs:string"/&gt; &lt;xs:element name="Demographics"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="1" maxOccurs="1" name="firstNames" type="xs:string"/&gt; &lt;xs:element minOccurs="1" maxOccurs="1" name="surname" type="xs:string"/&gt; &lt;xs:element minOccurs="1" maxOccurs="1" name="dateOfBirth" type="xs:dateTime"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:element name="Patient"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element ref="Demographics"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; </code></pre> <p>and oxygen generates an example XML which looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;QueryResponse xmlns="http://www.example.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.com/ file:/home/me/simplifiedResponse.xsd"&gt; &lt;Result&gt; &lt;Patient&gt; &lt;Demographics&gt; &lt;firstNames xmlns=""&gt;firstNames0&lt;/firstNames&gt; &lt;surname xmlns=""&gt;surname0&lt;/surname&gt; &lt;dateOfBirth xmlns=""&gt;2006-05-04T18:13:51.0Z&lt;/dateOfBirth&gt; &lt;/Demographics&gt; &lt;/Patient&gt; &lt;/Result&gt; &lt;/QueryResponse&gt; </code></pre> <p>My question is:</p> <ol> <li>Why does Oxygen generate child elements with empty xmlns attributes ? </li> <li>How can I BEST avoid this?</li> <li>Is it possible to create a schema which can correctly describe and validate an XML document which, rather, has no declared namespace (default or otherwise). </li> <li>If the answer to (c) is, 'yes', how would you modify my schema example</li> <li>What is a really good document to explain all this in a bit more depth, but be readable at the same time (i.e., I don't find documents at <a href="http://www.w3.org/XML/" rel="nofollow">http://www.w3.org/XML/</a> at all easy to understand or read). </li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload