tags:

views:

959

answers:

2

Is there any way to restrict the use of an XML element's sub elements, depending on the attribute value of the parent element in XML Schema? How does the schema have to look like?

<option name="mike" value="excset">
  <excludingsets>
    <excludingset>
      <option name="hd"/>
    </excludingset>
  </excludingsets>
</option>
<option name="mike" value="args">
  <arguments>
    <argument name="kjk" validatortype="regex">
      <regex value="dkas"/>
    </argument>
  </arguments>
</option>

As you can see in this example, the element <excludingset> should only be valid if the attribute value of <option> is value="excset", and the element <arguments> if it has value="args".

Thanks in advance.

+1  A: 

Not in W3C XML Schema 1.0. You can in ISO RelaxNG and, I believe, in W3C XML Schema 1.1.

Pete Kirkham
unfortunately i expected this answer :-(
rudimenter
A: 

Hello... could you solve that problem I'm try to do somethig like that right now.

Regards