Note that there are some explanatory texts on larger screens.

plurals
  1. POXML Schema Validation: How to validate "embedded" documents?
    primarykey
    data
    text
    <p>I'm not sure if the title of my question is correct, I don't think this is be called "embedded" document, but I dont know the exact term. So, first of all: "What does this guy mean?"</p> <pre><code>&lt;somedocument&gt; &lt;item cost="34"&gt; &lt;name&gt;Apple&lt;/name&gt; &lt;description&gt;A delicious apple!&lt;/description&gt; &lt;details xmlns:apple="http://example.org/apples"&gt; &lt;apple:color&gt;red&lt;/apple:color&gt; &lt;apple:cultivar&gt;Braeburn&lt;/apple:cultivar&gt; &lt;/details&gt; &lt;/item&gt; &lt;/somedocument&gt; </code></pre> <p>Now I want to validate this document using XMLSchema. I would create a schema for all the generic details of the document like the item structure and such. I know that I can use <code>&lt;xsd:any&gt;</code> to allow any kind of other XML within another document, which I can use to allow the apple specific elements inside the <code>&lt;details&gt;</code> section. So far, so good.</p> <p>But what if I want to validate all the elements in the <code>http://example.org/apples</code> namespace? Given that the document is not limited to apples, there might be bananas, kiwis and peaches and may grow in the future to have even more "embedded" documents.</p> <p>I there something in XMLSchema I missed which can help me do that? If not, what do you do in such cases? What are alternatives you can think of? As I use the Schemas also for documentation a "just parse the document and validate all the <code>&lt;details&gt;</code>yourself in code" solution isn't ideal.</p> <p>Thank you in advance!</p> <p><em>Edit</em>: After reading my whole question again there is a big point missing:</p> <ul> <li>The <code>&lt;details&gt;</code> section is not limited to key/value pairs as seen in the example, so replacing the whole namespace and custom element stuff with a generic key/value solution does not work.</li> </ul>
    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.
 

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