Skip to main content

Data Formats ( XML & JSON ) XML AND JSON | Generate XSD for Students

 

Generate XSD for Students


 Generate XSD for the following XML.

XYZ School wants to store the details of students in an xml file. The following scenario helps in designing the XML document.

Here StudentList  is the root tag. StudentList contains the entry of each student with rollno, name, age, address and department.

<?xml version="1.0" encoding="UTF-8"?>
<StudentList  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="StudentList.xsd">
    <Student rollno="2017CSE0055">
        <name>
            <firstname>Savitha</firstname>
        </name>
        <age>20</age>
        <address>
            <doorno>35</doorno>
            <street>NRG Street</street>
            <city>coimbatore</city>
            <pincode>641038</pincode>
        </address>
        <department>CSE</department>
    </Student>

    <Student rollno="2017ECE1050">
        <name>
            <firstname>Vinitha</firstname>
        </name>
        <age>21</age>
        <address>
            <doorno>9</doorno>
            <street>Randy Street</street>
            <city>Chennai</city>
            <pincode>600025</pincode>
        </address>
        <department>ECE</department>
    </Student>

    <Student rollno="2017EEE2044">
        <name>
            <firstname>Steve</firstname>
              <lastname> Johnson </lastname>
        </name>
        <age>19</age>
        <address>
            <doorno>15</doorno>
            <street>CMH Road</street>
            <city>Bangalore</city>
            <pincode>560039</pincode>
        </address>
        <department>EEE</department>
    </Student>
</StudentList>


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" 
attributeFormDefault="unqualified">
<xs:element name="StudentList">
<xs:complexType>
<xs:sequence>
<xs:element name="Student" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="name">
<xs:complexType>
<xs:all>
<xs:element name="firstname" type="xs:string" minOccurs="0"/>
<xs:element name="lastname" type="xs:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="age" type="xs:integer"/>
<xs:element name="address">
<xs:complexType>
<xs:sequence>
<xs:element name="doorno" type="xs:integer"/>
<xs:element name="street" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="pincode" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="department" type="xs:string"/>
</xs:sequence>
<xs:attribute name="rollno" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


Evaluation Result:


 

Result Description

Summary of tests
*Note: All the test cases might not have same weightage
+------------------------------+
|  1  test run/ 1  test passed |
+------------------------------+
 

Comments

Must Read:

Programming using Java Hands On - Control Structures | Bill Generation

Bill Generation Tom went to a movie with his friends in a multiplex theatre and during break time he bought pizzas, puffs and cool drinks.  Consider   the following prices :  Rs.100/pizza Rs.20/puffs Rs.10/cooldrink Generate a bill for What Tom has bought. Sample Input 1: Enter the no of pizzas bought:10 Enter the no of puffs bought:12 Enter the no of cool drinks bought:5 Sample Output 1: Bill Details No of pizzas:10 No of puffs:12 No of cooldrinks:5 Total price=1290 ENJOY THE SHOW!!! Result Description Summary of tests *Note: All the test cases might not have same weightage +------------------------------+ | 6 tests run/ 6 tests passed | +------------------------------+

Data Formats ( XML & JSON ) XML AND JSON | Pre-Quiz

  Feedback Congratulations!! You have passed by securing more than 80% Question  1 Correct Mark 1.00 out of 1.00 Flag question Question text What is the correct syntax in HTML for creating a link on a webpage? Select one: <link src="mcqsets.html"> <a href="mcqsets.html">   <a src="mcqsets.html"> <body link="mcqsets.html"> Feedback Your answer is correct. The correct answer is: <a href="mcqsets.html"> Question  2 Correct Mark 1.00 out of 1.00 Flag question Question text What are the new features in HTML5? Select one: All of these   Canvas element is provided for 2D drawing Better support for local storage Video and audio elements are available for media playbacK New form controls like calendar, date, time, email, URL, search  Feedback Your answer is correct. The correct answer is: All of these Question  3 Correct Mark 1.00 out of 1.00 Flag question Question text ____________ is the HTML5 attribute that speci

Data Formats ( XML & JSON ) XML AND JSON | Generate XSD for Persons

  Generate XSD for Persons Generate XSD for the following XML. XYZ organization wants to store the details of persons in an xml file. The following scenario helps in designing the XML document. Here PersonList  is the root tag. PersonList contains the entry of each person with adhaarno, name, age and address. <?xml version="1.0"  encoding="UTF-8"?> <PersonList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PersonList.xsd">     <Person>         <adhaarno>414356782345</adhaarno>         <name>             <firstname>Zeenath</firstname>         </name>         <age>28</age>         <address>             <doorno>33</doorno>             <street>Raidu Street</street>             <city>coimbatore</city>             <pincode>641039</pincode>         </address>     </Person>     <Perso

Programming using Java Running case study - Requirement 1 / 6 | State Board of Cricket Council –V1.0 *

  State Board of Cricket Council –V1.0 * State Board of Cricket Council   State Board of Cricket Council (SBCC) is one of the leading cricket selection academies in the state . They are in need of an automated system that should manipulate the player details provided and also find the players who have secured star rating between a specific range from the database. You being their software consultant have been approached to develop a pilot java application which can be used by the  admin for the above mentioned requirement . UserInterface.java package  com.sbcc.main; import  com.sbcc.model.*; import  java.util.*; import  java.lang.*; import  com.sbcc.skeletonvalidator.SkeletonValidator; public   class   UserInterface  {      public   static   Player   pl ;      public   static   void   main ( String []  args ) {          // CODE SKELETON - VALIDATION STARTS          // DO NOT CHANGE THIS CODE          SkeletonValidator   validator  =  new   SkeletonValidator ();          // CODE SKELETO

Subscribe to Get's Answer by Email