40 likes | 116 Views
Homelist Schema Example. <?xml version="1.0" ?> <xs:schema xmlns:xs= "http://www.w3.org/2001/XMLSchema"> <xs:element name="homelist"> <xs:complexType> <xs:sequence> <xs:element name="home" maxOccurs = " unbounded " > details of the home element -pto
E N D
Homelist Schema Example <?xml version="1.0" ?> <xs:schema xmlns:xs= "http://www.w3.org/2001/XMLSchema"> <xs:element name="homelist"> <xs:complexType> <xs:sequence> <xs:element name="home" maxOccurs = " unbounded " > details of the home element -pto </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
Homelist Example Continued Details of the home element <xs:element name="home" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name ="hname" type="xs:string"/> <xs:element name = "location" type="xs:string" /> <xs:element name = "contactdetails" minOccurs= "1" maxOccurs="3"> details of the contact details element -pto </xs:element> </xs:sequence> <xs:attribute name= "id" type="xs:string" use="required"/> </xs:complexType> </xs:element>
Homelist Example Continued Details of the contact details element <xs:element name = "contactdetails" minOccurs="1" maxOccurs="3"> <xs:complexType> <xs:sequence> <xs:element name ="cname" type="xs:string"/> <xs:element name = "phone" type="xs:string" /> <xs:element name = "email" type="xs:string minOccurs= "0" maxOccurs="1"/> <xs:element name = "url" type="xs:string minOccurs= "0" maxOccurs="1"/> </xs:sequence> </xs:complexType> </xs:element>
Answer 2 <xs:simpleType name = “teltype"> <xs:restriction base="xs:integer"> <xs:minInclusive value=“1000"/> <xs:maxInclusive value=“9999"/> </xs:restriction> </xs:simpleType> And in the person complex type <xs:element name = "tel" type= "teltype" minOccurs= "1" maxOccurs= "4"/>