/    /  XML – Child

XML – Child

In the XML family tree , child can be identified as the inner element of any other outer element in the hierarchy.
For suppose, if we have 2 elements called element A , element B and if the element A is the outer element of element B, then element B will be called as child of element A.

Please find the below example and identify the child elements of “employee”.

<?xml version="1.0" encoding="UTF-8"?> 

<company> 
<employee_list> 
	<employee> 
		<name> Hari</name> 
		<city> hyderabad</city> 
	</employee> 
	<employee> 
		<name> sneha</name> 
		<city> banglore</city> 
	</employee> 

</employee_list> 
<customer_list> 
	<customer> 
		<name> Sanjay</name> 
		<location> Mumbai</location> 
	</customer> 
	<customer> 
		<name> Micheal</name> 
		<location> Washington</location> 
	</customer> 
</customer_list> 
</company> 

Below figure shows the Ancestor child elements of “employee”.

XML child - i2tutorials.com