Note that there are some explanatory texts on larger screens.

plurals
  1. POXSD element with undefined contents
    primarykey
    data
    text
    <p>I need to rig up an XSD schema that will validate files partially. The file structure is:</p> <pre><code>&lt;Root&gt; &lt;Node name="core"&gt; &lt;ElementA&gt;String&lt;/ElementA&gt; &lt;ElementB&gt;String&lt;/ElementB&gt; &lt;/Node&gt; &lt;Node name="something unique"&gt; (any number of elements, with unknown names and types) &lt;/Node&gt; &lt;/Root&gt; </code></pre> <p>My XSD is something like:</p> <pre><code>&lt;xs:element name="Root"&gt; &lt;xs:complexType&gt; &lt;xs:sequence maxOccurs="unbounded"&gt; &lt;xs:element name="Node"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element maxOccurs="unbounded" /&gt; &lt;/xs:sequence&gt; &lt;xs:attribute name="name" type="xs:string" /&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; </code></pre> <p>Which is incomplete and not entirely correct, the un-named <code>&lt;xs:element&gt;</code> is invalid.</p> <p>There are a few nodes that are required, as well as each node having a unique name attribute; this is what I want to validate. The list of names, and the contents of those nodes, is predefined. </p> <p>The contents of nodes with unknown names is also unknown, and may contain any number of elements with any name and type, but must not have attributes or values themselves.</p> <p>The part I'm having trouble with is allowing child elements without knowing their names.</p> <p>Is it at all possible to do something like this with XSD? Is there a way to have a complex type of elements, or anyType, and an attribute?</p> <p><strong>Edit:</strong> It would be just as acceptable to use the <code>&lt;Node&gt;</code> <code>name</code>s as the element type, and then simply allow additional elements with unknown names. Either way, I need to allow nodes with unknown name and type.</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. 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