Sunday 24 December 2017

Creating a Simple XML Document in XML

Here we create a simple XML document by using user-defined elements and attributes. Now create a valid XML document name is simplexmldoc.xml to understand the structure of an XML document.

///// simplexmldoc.xml /////
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<books>
<book>
<subject standard="class v">History </subject>
<author>D. P.Mishra </author>
<publisher>FGB</publisher>
<price>RS 200/-</price>
</book>

<book>
<subject standard="class v">Math </subject>
<author>D. S.Mishra </author>
<publisher>FGB</publisher>
<price>RS 270/-</price>
</book>

<book>
<subject standard="class v">English  </subject>
<author>R.S.KUMAR</author>
<publisher>FGB</publisher>
<price>RS 210/-</price>
</book>

<book>
<subject standard="class v">Science </subject>
<author>P.S SHARMA  </author>
<publisher>FGB</publisher>
<price>RS 250/-</price>
</book>
</books>

The XML declaration line version and encoding format of the XML document. Next the root element, books, contains the book element four times. The element further contains the subject, author, publisher, and price child elements. 

No comments:

Post a Comment