0
votes

Below is my sample XML:

  <RootElement attributeName="Value1">
    <ChildElement>0</ChildElement>
    <ChildElement>1</ChildElement>
    <ChildElement>2</ChildElement>
    <ChildElement>3</ChildElement>
  </RootElement>

I want to add restriction based on value of attributeName. Value of attributeName can be Value1|Value2|Value3. If the value of attribute name is Value1 or Value2 then no child element should be present. If the value of attribute name is Value3 then there should be min 1 and max 15 ChildElement occurrences. I want to achieve this with XSD v1.0. I found some solutions with XSD v1.1 but I can't use them because I want to achieve this in XSD v1.0. I found some solutions with abstract and choice but with that it provide different child elements names. I can have only "ChildElement". I can't use other child elements.

1
If I have to use XSD v1.0 then what will be changes required in .Net application to process XSD v1.0? - Bhushan

1 Answers

0
votes

This kind of restriction is not possible with XSD 1.0. You can achieve same by using Assert or Rule in XSD 1.1 or later.