Generate XSD 5

Question:

<?xml version=”1.0″ encoding=”UTF-8″?>

<mobilestore>

<mobile>

<brand>Nokia</brand>

<os>Symbian</os>

<model>C6</model>

<ram>1gb</ram>

<internal>8gb</internal>

</mobile>

<mobile>

<brand>Samsung</brand>

<os>Android</os>

<model>Galaxy</model>

<ram>2gb</ram>

<internal>8gb</internal>

</mobile>

<mobile>

<brand>Sony</brand>

<os>Android</os>

<model>Experia</model>

<ram>512mb</ram>

<internal>16gb</internal>

</mobile>

</mobilestore>

Code:

mobile.xsd

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name = "mobilestore">
<xs:complexType>
<xs:sequence>
<xs:element name = "mobile" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name = "brand" type="xs:string"/>
<xs:element name = "os" type="xs:string"/>
<xs:element name = "model" type="xs:string"/>
<xs:element name = "ram" type="xs:string"/>
<xs:element name = "internal" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Recommended:

Leave a Comment

Your email address will not be published. Required fields are marked *

x