/    /  XML – Ancestor

XML – Ancestor

XML family tree can understand better with some relations between elements hierarchy. We know that elements within the elements is the regular structure of XML which consists one root element for all.

Every inner element will have one or more outer elements which can be identified as Ancestors.

Please find the below example and identify the ancestors for element “city”.

<?xml version="1.0" encoding="UTF-8"?> 
		<name> Hari</name> 
		<city> hyderabad</city> 
		<name> sneha</name> 
		<city> banglore</city> 

		<name> Sanjay</name> 
		<location> Mumbai</location> 
		<name> Micheal</name> 
		<location> Washington</location> 

Below figure shows the Ancestor elements of “city” 

XML ancestor element