What is the correct syntax for XSD to restrict attrributes values in the elements list?

Posted by Leonard on Stack Overflow See other posts from Stack Overflow or by Leonard
Published on 2010-03-31T08:59:25Z Indexed on 2010/03/31 9:33 UTC
Read the original article Hit count: 344

Filed under:
|

What is the correct syntax for XSD schema to define the following restriction:

In the list of elements we have to specify that attribute can contain value of "c" unlimited number of times, but value of "b" - the zero or only one time.

For example, the correct xml looks like this:

<root>
<elem atr="c">111</elem>
<elem atr="c">222</elem>
<elem atr="b">333</elem>
<elem atr="c">444</elem>
<elem atr="c">555</elem>
</root>

And incorrect one is:

<root>
<elem atr="c">111</elem>
<elem atr="c">222</elem>
<elem atr="b">333</elem>
<elem atr="c">444</elem>
<elem atr="b">555</elem>
</root>

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xsd