0% found this document useful (0 votes)
23 views3 pages

Create and Validate XML Database

Uploaded by

malathimeena0405
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views3 pages

Create and Validate XML Database

Uploaded by

malathimeena0405
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Ex. No.

12​ ​ Create an XML database and validate using XML schema

Aim:

​ To create an XML database using XML formatter and validate it using XML
schema.

XML Database:

​ XML is a markup language that is based on Standard Generalized Markup
Language (SGML). XML Database is used to store huge amounts of information in
the XML format. The primary function of XML is to create the data format that
encodes information for documentation, database records, transactions and many other
types of data.

XML document
<?xml version="1.0" encoding="UTF-8"?>
<class>
<employee>
<name>Malathi</name>
<age>20</age>
<department>Analysis</department>
<role>ML Engineer</role>
</employee>
<employee>
<name>Sudhan</name>
<age>24</age>
<department>Analysis</department>
<role>Business Analyst</role>
</employee>

XML Schema Definition (XSD)

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"


xmlns:xs="[Link]
<xs:element name="class">
<xs:complexType>
<xs:sequence>
<xs:element name="employee" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="name"/>
<xs:element type="xs:byte" name="age"/>
<xs:element type="xs:string" name="department"/>
<xs:element type="xs:string" name="role"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Validation of XML document:

​ To validate the XML document, the XML document along with its XML
Schema Definition is necessary. The XML validator compares both and checks
whether the provided document is valid or not.
Result:
Thus the XML database using XML formatter has been created and validated
using XML schema.

You might also like