in the xml file , there are nodes with same name in different levels. How can i distinguish based on the leve or parent
<account email="[email protected]" >
<contacts>
<contact>
<id>
0
</id>
</contact>
<contact>
<id>
1
</id>
</contact>
<contact>
<id>
2
</id>
</contact>
</contacts>
<groups>
<group>
<groupname>
xyz
</groupname>
<members>
<contact>
<id>
7
</id>
</contact>
<contact>
<id>
8
</id>
</contact>
</members>
</group>
</groups>
here i have contact under contacts as well as under groups ->group->memebers I need to distinguish between them if i try
doc.getElementsByTagName("contact");
it will return all the contact nodes in all levels. This is not what is required. I need to contact unders contacts separate and under memebers separate.
Please help.