When an element is declared globally then it can be referenced by any other element declaration.
Ads
TutorialsAds
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="line1" type="xs:string"/> <xs:element name="line2" type="xs:string"/> <xs:element name="Address"> <xs:complexType> <xs:sequence> <xs:element ref="line1"/> <xs:element ref="line2"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> |
<?xml
version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="myelm1"> <xs:complexType> <xs:sequence> <xs:element name="myelm2"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:length value="10"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> |
Advertisements
Posted on: November 22, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles