Friday 7 November 2014

Rules of the xml document


1.           An XML document must have single root element.
2.           All start tags must matched by end tags.
3.           All attribute values must be quoted.

<?xml version="1.0"?>
<books>
  <book>
    <name>Let Us C</name>
    <author>Yashwant Kanetkar</author>
    <price>245.00</price>   
  </book>
  <book>
    <name>Let Us C++</name>
    <author>Yashwant Kanetkar</author>
    <price>252.00</price>   
  </book>
  <book>
    <name>Java The Complete Reference</name>
    <author>Herbert Schildt</author>
    <price>489.00</price>   
  </book>
  <book>
    <name>HTML5 Black Book</name>
    <author>Kogent Learning Solutions</author>
    <price>485.00</price>   
  </book>  
</books>


In the above xml document <books> is the root element.

Note : XML parser parse the xml document only if the document is well formed with above xml rules..

Prevoius                                                 Next                                                 Home

No comments:

Post a Comment