Skip to main content

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>

    <Person Category="seniorcitizen">
        <adhaarno>414356782345</adhaarno>
        <name>
            <firstname>Simon</firstname>
        </name>
        <age>75</age>
        <address>
            <doorno>7</doorno>
            <street>Raja Street</street>
            <city>Chennai</city>
            <pincode>600005</pincode>
        </address>
    </Person>

    <Person>
        <adhaarno>414356782345</adhaarno>
        <name>
            <lastname>Varma</lastname>
        </name>
        <age>25</age>
        <address>
            <doorno>25</doorno>
            <street>cox street</street>
            <city>Bangalore</city>
            <pincode>560025</pincode>
        </address>
    </Person>
</PersonList>


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
 elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="PersonList">
<xs:complexType>
<xs:sequence>
<xs:element name="Person" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="adhaarno" type="xs:integer"/>
<xs:element name="name">
<xs:complexType>
<xs:choice>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:choice>
</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:sequence>
<xs:attribute name="Category" 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:

RDBMS Data Definition Language | Create Buses table

 efer the below schema and create the buses table. Column Name Datatype Size Constraint Constraint name Bus_no Number 11 Primary key PK_BUSES Bus_name Varchar2 20   Type Varchar2 20   Total_seats Number 11   Avail_seats Number 11     Result Description Summary of tests +------------------------------+ | 3 tests run / 3 test passed | +------------------------------+

Programming using Java Hands On - Control Structures | Celcius to Farenheit Conversion

  Celcius to Farenheit Conversion Write a program to convert  Celsius to Farenheit.  Display the result correct to 1 decimal. Create a class "CelsiusConversion.java" and write the main method. Hint : 5 * (F – 32) = 9 * C,   F-Farenheit , C- Celsius   Sample Input  1 : 80 Sample Output  1 : 176.0 Sample Input  2 : 88 Sample Output  2 : 190.4 Result Description Summary of tests *Note: All the test cases might not have same weightage +------------------------------+ | 7 tests run/ 7 tests passed | +------------------------------+

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>     ...

DFA Solutions

  Question  1 Correct Mark 1.00 out of 1.00 Flag question Question text To secure the http messages in the API calls, its necessary to: Select one: a. All the above b. Use cryptography c. implement identity management d. avoid hardcoding any sensitive data in the messages Feedback The correct answer is: All the above Question  2 Correct Mark 1.00 out of 1.00 Remove flag Question text A team has completed 10 Sprints and moving to the 11th Sprint. Till Sprint 10, the team has achieved an average of 50 story points per sprint. The same is projected as their velocity for the upcoming sprints with the Client. What is this approach called? Select one: a. Velocity Driven Sprint Planning b. Velocity Driven Commitment c. Commitment Driven Velocity d. Commitment Driven Sprint Planning Feedback The correct answer is: Velocity Driven Sprint Planning Question  3 Incorrect Mark 0.00 out of 1.00 Remove flag Question text Jack is grooming himself to be a potential Product Owner. Kno...

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 ) {        ...

Star Pattern

  /* @ToDo     Star Pattern                  *                *   *   *            *   *   *   *   *        *   *   *   *   *   *   *    *   *   *   *   *   *   *   *   *    *   *   *   *   *   *   *   *   *        *  ...

Count Encodings

 1. You are given a string str of digits. (will never start with a 0) 2. You are required to encode the str as per following rules     1 -> a     2 -> b     3 -> c     ..     25 -> y     26 -> z 3. You are required to calculate and print the count of encodings for the string str.      For 123 -> there are 3 encodings. abc, aw, lc      For 993 -> there is 1 encoding. iic       For 013 -> This is an invalid input. A string starting with 0 will not be passed.      For 103 -> there is 1 encoding. jc      For 303 -> there are 0 encodings. But such a string maybe passed. In this case       print 0. Input Format A string str Output Format count of encodings Constraints 0 < str.length <= 10 Sample Input 123 Sample Output 3 Solution: import java.io.*; import java.util.*; public class Main {   ...

UNIX Introduction to Unix | Post-Quiz

 UNIX  Introduction to Unix  Post-Quiz  Feedback Congratulations! You have passed by securing more that 80%. Question  1 Correct Mark 1.00 out of 1.00 Flag question Question text  What is the default maximum number of processes that can exist in Unix? Select one: a.  unlimited b.   32768           c.   4096        d.  1024          Feedback Your answer is correct. The correct answer is:  32768         Question  2 Correct Mark 1.00 out of 1.00 Flag question Question text Single user mode shell has _____ prompt.  Select one: a.   $ Normal user  b.  % Admin user c.  ~ Home user d.  # Root user    Feedback Your answer is correct. The correct answer is: # Root user  Question  3 Correct Mark 1.00 out of 1.00 Flag question Question text Predict the output for the following...

Subscribe to Get's Answer by Email