Jump to content

restriction on element and on attribute


WoZoI

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

Link to comment
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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...