Restriction for complexType

S

Sami Ather

does anybody knows how to put a restrcition on a complexType with an
attribute.
eg we have a tag score and there is an attribute round for this tag.
round attribute can have values from 1 to 9 and based upon round
number we have different upper limit for scores like
<score round="1">256</score> # maximum score for round 1 can be 256
<score round="2">128</score> # maximum socre for round 2 can be 128
<score round="3">56</score> # maximum score for round 3 can be 56
!!!!
 
M

Martin Honnen

Sami said:
does anybody knows how to put a restrcition on a complexType with an
attribute.
eg we have a tag score and there is an attribute round for this tag.
round attribute can have values from 1 to 9 and based upon round
number we have different upper limit for scores like
<score round="1">256</score> # maximum score for round 1 can be 256
<score round="2">128</score> # maximum socre for round 2 can be 128
<score round="3">56</score> # maximum score for round 3 can be 56

I don't think W3C XML schema allows you to constraint the content of an
element in relation to the value of an attribute.
Such constraints can be expressed and checked with schematron for instance:
<http://xml.ascc.net/resource/schematron/schematron.html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top