Tuesday 26 December 2017

How to Create an XML Tree in XML

XML elements can be nested inside one another to make an XML Tree. Now create an XML document named xmltree.xml to understand how an XML document is represented as a tree.

///// xmltree.xml file /////

<person>
<name>
<first_name>petter </first_name>
<last_name>smith</last_name>
</name>
<address>
<house_no>26<house_no>
<lane_no>12</lane_no>
<city>Delhi </city>
<state>Delhi </state>
<country>india</country>
</address>
<contact_no>
<land_line>0000000000</land_line>
<mobile>1234567890</mobile>
</contact_no>
</person>

Here : person is the root element and name, address, and contact_no are it's child elements. The name element contains two child elements, first_name and last_name. The address element contains five child elements, house_no, lane_no, city, state, and country. The contact_no element contains two child elements land_line and mobile. 

No comments:

Post a Comment