Write an XML document according to the following XML Schema

Write an XML document according to the following XML Schema Definition:

<?xml version=\"1.0\" encoding=\"UTF-8\"?>

<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">

     

      <xsd:element name=\"students\" type=\"StudentsType\"/>

      <xsd:complexType name=\"StudentsType\">

            <xsd:sequence>

                  <xsd:element name=\"student\" type=\"StudentType\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>

            </xsd:sequence>

      </xsd:complexType>

     

      <xsd:complexType name=\"StudentType\">

            <xsd:sequence>

                  <xsd:element name=\"firstname\" type=\"xsd:string\" />

                  <xsd:element name=\"lastname\" type=\"xsd:string\" />

                  <xsd:element name=\"age\" maxOccurs=\"1\">

                        <xsd:simpleType>

                              <xsd:restriction base = \"xsd:positiveInteger\">

                                    <xsd:maxInclusive value = \"60\"/>

                              </xsd:restriction>

                        </xsd:simpleType>

                  </xsd:element>

                  <xsd:element name=\"address\" type=\"AddressType\" />

            </xsd:sequence>

           

            <xsd:attribute name=\"ID\" type=\"xsd:positiveInteger\" use=\"required\"/>

      </xsd:complexType>

     

      <xsd:complexType name=\"AddressType\">

            <xsd:sequence minOccurs=\"0\" maxOccurs=\"1\">

                  <xsd:element name=\"street\" type=\"xsd:string\" />

                  <xsd:element name=\"number\" type=\"xsd:string\" />

                  <xsd:element name=\"city\" type=\"xsd:string\" />              

                  <xsd:element name=\"country\">

                        <xsd:simpleType>

                              <xsd:restriction base = \"xsd:string\">

                                    <xsd:maxLength value=\"2\"/>

                              </xsd:restriction>

                        </xsd:simpleType>

                  </xsd:element>

            </xsd:sequence>

      </xsd:complexType>

</xsd:schema>

Solution

Hi buddy, please find the below XML document from the given schema

<?xml version=\"1.0\" encoding=\"utf-8\"?>
<students>
<student ID=\"275\">
<firstname>calero</firstname>
<lastname>Juan</lastname>
<age>41</age>
<address>
<street>downtown</street>
<number>312</number>
<city>Naples</city>
<country>USA</country>
</address>
</student>
<student ID=\"310\">
<firstname>Siva Kumar</firstname>
<lastname>rachumalla</lastname>
<age>53</age>
<address>
<street>westmister</street>
<number>479</number>
<city>Newyork</city>
<country>USA</country>
</address>
</student>
</students>

Write an XML document according to the following XML Schema Definition: <?xml version=\
Write an XML document according to the following XML Schema Definition: <?xml version=\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site