I have to validate following XML (used in thirdparty REST service) against XML Schema.
There are some Key
elements that are obligatory for service.
<?xml version="1.0" encoding="UTF-8"?>
<Data>
<Details>
<Key name="ONE" label="a" value="11"/>
<Key name="THREE" label="c" value="33"/>
<Key name="TWO" label="b" value="22"/>
</Details>
</Data>
Is there any way (using XML Schema) to force element Details
to contain all three Key
elements with name attribute set to specific values, respectively ONE
, TWO
and THREE
? No particular order of Key
elements should be required.
Also additional Key
elements should be possible:
<?xml version="1.0" encoding="UTF-8"?>
<Data>
<Details>
<Key name="ONE" label="a" value="11"/>
<Key name="THREE" label="c" value="33"/>
<Key name="TWO" label="b" value="22"/>
<Key name ="OPTIONAL1" label="opt1" value="opt1"/>
<Key name ="OPTIONAL2" label="opt2" value="opt2"/>
</Details>
</Data>
Is there any chance to do it using schema? Please help!