Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If <code>type</code> is what you are talking about then .. It's <code>&lt;xs:Include&gt;</code> not <code>&lt;xs:Import&gt;</code> ..</p> <p>And the answer is : <b>Parser takes care of linking all XSDs together</b></p> <p>see the example below:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;root&gt; &lt;child&gt;trial&lt;/child&gt; &lt;child2&gt;trial2&lt;/child2&gt; &lt;trunk&gt; &lt;branch&gt;1&lt;/branch&gt; &lt;branch&gt;2&lt;/branch&gt; &lt;/trunk&gt; &lt;specialchild&gt;test&lt;/specialchild&gt; &lt;/root&gt; </code></pre> <p>For the above XML I will design an XSD:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;xs:include schemaLocation="include multiple XSDs2.xsd"/&gt; &lt;xs:element name="root" type ="root"/&gt; &lt;xs:complexType name="root"&gt; &lt;xs:sequence&gt; &lt;xs:element name="child" type="xs:string" /&gt; &lt;xs:element name="child2" type="xs:string" /&gt; &lt;xs:element name="trunk" type="trunk"/&gt; &lt;xs:element name="specialchild" type="specialchild"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt; </code></pre> <p>where type trunk is defined in <code>import multiple XSDs2.xsd</code> file and linked by using <code>&lt;xs:include&gt;</code> .. (which is residing in the same folder).. And the code looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;xs:include schemaLocation="include multiple XSDs3.xsd"/&gt; &lt;xs:complexType name="trunk"&gt; &lt;xs:sequence&gt; &lt;xs:element maxOccurs="unbounded" name="branch" type="branch" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt; </code></pre> <p>and type branch is a simple type defined in <code>include multiple XSDs3.xsd</code> file, and the code looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;xs:simpleType name="branch"&gt; &lt;xs:restriction base="xs:string"/&gt; &lt;/xs:simpleType&gt; &lt;xs:simpleType name="specialchild"&gt; &lt;xs:restriction base="xs:string"/&gt; &lt;/xs:simpleType&gt; &lt;/xs:schema&gt; </code></pre> <p>*<strong>Now the tricky part is: <code>specialchild</code> is declared in <code>XSD_1</code> where as defined in <code>XSD_3</code> and these two XSDs are linked by <code>XSD_2</code>.. You can observe that parser by default takes care of linking all XSDs and treating them all as one! *</strong></p> <p>Hope this solves your question!</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