Jump to content
Sign in to follow this  
WoZoI

restriction on element and on attribute

Recommended Posts

Hello,I am new in using xsd, I a read the W3 tutorial and now I am on practice. I am currently facing a diffciulty that I want to share and solve.So here it is :the XML I want to validate look like this :<Element attribute1="[0-100]">OneEnumValue</Element>I haven't yet discover the way to combine the description of the two restriction the first one hat is on the attribut and the second which is on the textElement.I can't believe this kind of validation could not be possible.I am trying to achieve it by describing two single complexType that bear the Restriction.And finally to combine each named element within the one I want to validate my document.Does someone can share about this double restriction issue?thank you,WoZoI

Share this post


Link to post
Share on other sites

the xml element I want to validate:<MessageLevel Certainty="100">Warning</MessageLevel>the correct schema I just solved : <xs:simpleType name="fxctg"> <xs:restriction base="xs:string"> <xs:enumeration value="None"/> <xs:enumeration value="Breaking"/> <xs:enumeration value="NonBreaking"/> <xs:enumeration value="DependsOnFix"/> </xs:restriction></xs:simpleType><xs:complexType name="msglvlFullType"> <xs:simpleContent> <xs:extension base="local:msglvlType"> <xs:attribute name="Certainty"> <xs:simpleType> <xs:restriction base="xs:integer"> <xs:minInclusive value="0"/> <xs:maxInclusive value="100"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:extension> </xs:simpleContent></xs:complexType>[.....]<xs:element name="MessageLevel" type="local:msglvlFullType"/>I just discover the right way to combien the type in using the extension.Thank you very muchthank you,WoZoII AM A RIOTERDECKER

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...