XML Documents

It is a basic unit of XML information composed of elements and other markup in an orderly package. It contains wide variety of data. A tree structure is make to describe an XML document.

Example of an XML document

<?xml version="1.0"?>  
<office>  
<employee>  
        <firstname>Ajay</firstname>  
        <lastname>Singh</lastname>  
        <contact>9453754048</contact>  
        <email>[email protected]</email>  
        <address>  
            <city>Allahabad</city>  
            <state>U.P</state>  
<pin>211001</pin>  
</address>  
    </employee>  
</office>
In above programing example, first line is XML deceleration, it defines XML versions 1.0. Next line shows the root element (office) of the document. Inside that there is one more element (employee). Employee element contains five branches named <firstname>, <lastname>, <contact>, <email>, <address>. <address> branch contains three sub-branches <city>, <state>, <pin>.

Document Prolog Section

It is the top of the document, before root element.