sleax Posted June 22, 2012 Share Posted June 22, 2012 Hi to all!I've a question to ask to you.If i have a simple type, i know how to set any restriction, like this: ....<xs:element name="age" type="integer"><xs:simpleType> <xs:restriction base="xs:integer"> <xs:minInclusive value="3"/> <xs:maxInclusive value="10"/> </xs:restriction></xs:simpleType></xs:element>.... So i can only put a integer number included among [3,10].if i want to do this in a complexType like here ...<xs:element name="person"><xs:complexType><xs:sequence> <xs:element name="age" type="xs:integer">...</xs:sequence></xs:complexType></xs:element>.... it should be something like this ...<person><age>99</age></person>... but if i want to set limits to integer value age? Link to comment Share on other sites More sharing options...
boen_robot Posted June 22, 2012 Share Posted June 22, 2012 You need to define your own simple type, and then set THAT type as the type of the element(s) you want it on - in this case, the "age" element.So for example: <xs:element name="person"><xs:complexType><xs:sequence> <xs:element name="age" type="childAge">...</xs:sequence></xs:complexType></xs:element><xs:simpleType name="childAge"> <xs:restriction base="xs:integer"> <xs:minInclusive value="3"/> <xs:maxInclusive value="10"/> </xs:restriction></xs:simpleType> Link to comment Share on other sites More sharing options...
sleax Posted June 23, 2012 Author Share Posted June 23, 2012 Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now