Note that there are some explanatory texts on larger screens.

plurals
  1. POXSD Import NameSpaces
    text
    copied!<p>I have a two xsd files "first.xsd" and "second.xsd". </p> <p>Inside second.xsd, I want to refer to an element defined in first.xsd (with different namespace).<br> My second.xsd looks like:</p> <pre><code>&lt;xs:schema ... xmlns:schema1="http://www.schema.org/schema1" targetNamespace "http://www.schema.org/schema2 ... &gt; &lt;xs:import namespace = "http://www.schema.org/schema1" schemaLocation = "first.xsd" /&gt; &lt;xs:element name = "complex1"&gt; &lt;xs:complexType&gt; ......... &lt;xs:element ref="schema1:name2"/&gt; ......... &lt;/xs:complexType&gt; &lt;/xs:element&gt; </code></pre> <p>Now I want to include and import second.xsd inside first.xsd So I do the following in first.xsd:</p> <pre><code>&lt;xs:schema ... xmlns:schema2="http://www.schema.org/schema2" targetNamespace "http://www.schema.org/schema1 ... &gt; &lt;xs:import namespace="http://www.schema.org/schema2" schemaLocation="second.xsd"&gt; &lt;xs:element name = "name1"/&gt; &lt;xs:element name = "name2"/&gt; &lt;xs:element name = "name3"/&gt; </code></pre> <p>Is this the right way to do since I not able to successfully validate the schema.<br> Is it a problem because of some cyclic namespace inclusion??<br> I'm using oxygen xml developer to validate the schema files and my first.xsd when validated says:<br> E[Xerces] src-resolve: Cannot resolve the name to a(n) type definition component. (second.xsd)</p> <p>But if I validate the second.xsd file separately it says schema valid.</p> <p>In my actual case I have a very complex scenario so I've boiled it down to a simple example as shown above.<br> Could someone please help. </p>
 

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