Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This pattern is also known as <em>chameleon</em>. It means you're <strong>including</strong> an XML Schema that has no target namespace, which in turn makes that schema <em>assume</em> the namespace of the <em>parent</em> schema.</p> <p>UPDATE: considering the sample XML provided in the comments:</p> <p>First schema file (AttrGroup.xsxd):</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;xsd:schema elementFormDefault="qualified" attributeFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;xsd:attributeGroup name="attr-group"&gt; &lt;xsd:attribute name="attr1" type="xsd:string"/&gt; &lt;xsd:attribute name="attr2" type="xsd:int"/&gt; &lt;/xsd:attributeGroup&gt; &lt;/xsd:schema&gt; </code></pre> <p>Second schema file (A.xsd):</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;xsd:schema targetNamespace="http://tempuri.org/XMLSchema.xsd/a" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd/a" xmlns:a="http://tempuri.org/XMLSchema.xsd/a" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;xsd:include schemaLocation="AttrGroup.xsd"/&gt; &lt;xsd:attributeGroup name="a-group"&gt; &lt;xsd:attributeGroup ref="attr-group"/&gt; &lt;/xsd:attributeGroup&gt; &lt;/xsd:schema&gt; </code></pre> <p>Third schema file (B.xsd):</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;xsd:schema targetNamespace="http://tempuri.org/XMLSchema.xsd/b" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd/b" xmlns:b="http://tempuri.org/XMLSchema.xsd/b" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;xsd:include schemaLocation="AttrGroup.xsd"/&gt; &lt;xsd:attributeGroup name="b-group"&gt; &lt;xsd:attributeGroup ref="attr-group"/&gt; &lt;/xsd:attributeGroup&gt; &lt;/xsd:schema&gt; </code></pre> <p>Fourth XML Schema (Element.xsd):</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;!--XML Schema generated by QTAssistant/XSD Module (http://www.paschidev.com)--&gt; &lt;xsd:schema elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://tempuri.org/XMLSchema.xsd/a" xmlns:b="http://tempuri.org/XMLSchema.xsd/b"&gt; &lt;xsd:import namespace="http://tempuri.org/XMLSchema.xsd/a" schemaLocation="A.xsd"/&gt; &lt;xsd:import namespace="http://tempuri.org/XMLSchema.xsd/b" schemaLocation="B.xsd"/&gt; &lt;xsd:element name="element"&gt; &lt;xsd:complexType&gt; &lt;xsd:attributeGroup ref="a:a-group"/&gt; &lt;xsd:attributeGroup ref="b:b-group"/&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:schema&gt; </code></pre> <p><img src="https://i.stack.imgur.com/aEyWg.jpg" alt="XML Schema files layout"></p> <p>Sample of valid XML:</p> <pre><code>&lt;element xmlns:a="http://tempuri.org/XMLSchema.xsd/a" xmlns:b="http://tempuri.org/XMLSchema.xsd/b" a:attr1="hello" b:attr2="10" /&gt; </code></pre> <p>Sample of invalid XML:</p> <pre><code>&lt;element xmlns:a="http://tempuri.org/XMLSchema.xsd/a" xmlns:b="http://tempuri.org/XMLSchema.xsd/b" a:attr1="hello" b:attr2="10a" /&gt; </code></pre> <p>When validating against Element.xsd the invalid sample, I am getting this error message (on my tool): Error occurred while loading [], line 1 position 116 The '<a href="http://tempuri.org/XMLSchema.xsd/b:attr2" rel="nofollow noreferrer">http://tempuri.org/XMLSchema.xsd/b:attr2</a>' attribute is invalid - The value '10a' is invalid according to its datatype '<a href="http://www.w3.org/2001/XMLSchema:int" rel="nofollow noreferrer">http://www.w3.org/2001/XMLSchema:int</a>' - The string '10a' is not a valid Int32 value. D:...\SampleAttrGroup.xml is invalid.</p>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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