Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking the "grandparent" nodeName

Status
Not open for further replies.

Muddmuse

Programmer
Jul 31, 2001
85
US
What is the most efficient way to check the nodeName of a "grandparent" node?

<grandparent>
<parent>
<child/>
<parent>
</grandparent>

If <child> is the context node how do I find the nodeName property of the grandparent?
 
i'm doing this using the MSXML parser on IIS for ASP pages. this is a small example in VBScript of how you may be able to do what you're asking:

Code:
dim rootNode    ' doc element
dim currNode    ' node	
dim sGPnodeName ' grandparent node name

set rootNode = objXML.documentElement
set currNode = rootNode.selectSingleNode(&quot;//someNode&quot;)

sGPNodeName = (currNode.parentNode).parentNode.nodeName

hope this helps. &quot;Until you have the courage to lose sight of the shore, you will not know the terror of being forever lost at sea.&quot; - a very wise man
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top