Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The problem is you've accidentally defined two different <code>element</code>s with the name "domain".</p> <p>This defines one, which can occur only inside <code>configuration</code>:</p> <pre><code> &lt;xs:element name="domain"/&gt; </code></pre> <p>And this defines the other, which can only occur as a root element (you can see this if you remove the <code>configuration</code> element and have <code>domain</code> as the root - it won't validate anymore):</p> <pre><code>&lt;xs:element name="domain"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:any minOccurs="0"/&gt; &lt;/xs:sequence&gt; &lt;xs:attribute name="account" type="uid" use="required"&gt; &lt;/xs:attribute&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; </code></pre> <p>Since the first definition doesn't say anything about its attributes, in your sample document the attribute "account" on your <code>domain</code> element is valid with any type.</p> <p>To define only one element, the best way is to make the <code>element</code> definition you have into a <code>complexType</code>, and refer to that (the other alternative is to move all the <code>complexType</code> stuff inside the first <code>domain</code> deinfition):</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.com/api/2.2" elementFormDefault="qualified" version="1.0" xml:lang="EN" targetNamespace="http://www.example.com/api/2.2"&gt; &lt;xs:element name="configuration"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="domain" type="domain"/&gt; &lt;!-- changed here --&gt; &lt;/xs:sequence&gt; &lt;xs:attribute name="timestamp" type="xs:normalizedString" use="optional"/&gt; &lt;xs:attribute name="version" type="xs:token" fixed="2.2"/&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:complexType name="domain"&gt; &lt;!-- and here --&gt; &lt;xs:sequence&gt; &lt;xs:any minOccurs="0"/&gt; &lt;/xs:sequence&gt; &lt;xs:attribute name="account" type="uid" use="required"&gt; &lt;/xs:attribute&gt; &lt;/xs:complexType&gt; &lt;xs:simpleType name="uid"&gt; &lt;xs:restriction base="xs:string"&gt; &lt;xs:length value="36"/&gt; &lt;xs:pattern value="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"/&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; &lt;/xs:schema&gt; </code></pre>
 

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