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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XPath (How do I get the parent)

Status
Not open for further replies.

Jawa

Programmer
Feb 21, 2002
74
0
0
US
I have an XML file that resembles:


######BEGIN#######
<maincontainers>
<container ID=&quot;DD364AA5-C09F-0662-D2A6372503A93F48&quot; menu=&quot;yes&quot; name=&quot;Visit&quot;>
<content ID=&quot;239&quot; label=&quot;rt-239&quot; ctcd=&quot;FCT&quot;>test</content>
<content ID=&quot;240&quot; label=&quot;345345-240&quot; ctcd=&quot;FAQ&quot;>345345</content>
<content ID=&quot;252&quot; label=&quot;all-about-flowers-252&quot; ctcd=&quot;WEB&quot;>All about Flowers</content>
<container ID=&quot;4F1F609F-C09F-0662-D2E8527FEE4037C4&quot; menu=&quot;yes&quot; name=&quot;Visit the Garden&quot;>
<content ID=&quot;254&quot; label=&quot;visit-the-garden-254&quot; ctcd=&quot;WEB&quot;>Visit the Garden</content>
</container>
<container ID=&quot;4F1FB6AF-C09F-0662-D24C4E0656BB62DF&quot; menu=&quot;yes&quot; name=&quot;About the Garden&quot;>
<content ID=&quot;255&quot; label=&quot;about-the-garden-255&quot; ctcd=&quot;WEB&quot;>About the Garden</content>
</container>
<container ID=&quot;4F204022-C09F-0662-D2CFF7B76EE9F437&quot; menu=&quot;yes&quot; name=&quot;Glasshouse and Garden Tour&quot;>
<content ID=&quot;256&quot; label=&quot;glasshouse-and-garden-tour-256&quot; ctcd=&quot;WEB&quot;>Glasshouse and Garden Tour</content>
</container>
<container ID=&quot;4F21774A-C09F-0662-D2BBAFBE84EE75F0&quot; menu=&quot;yes&quot; name=&quot;Contact Us&quot;>
<content ID=&quot;257&quot; label=&quot;contact-us-257&quot; ctcd=&quot;BLB&quot;>Contact Us</content>
</container>
</container>
</mainContainers>
######END#######

What I am trying to accomplish is to build an XPath Query that will enable me get the parent container.

If the parent of this XML Document is:

ID=&quot;DD364AA5-C09F-0662-D2A6372503A93F48&quot;

If I am in a child container how can I accomplish to writing a XPath to find the parent from the child?

THANK YOU VERY MUCH!!!!!



 
parent::* -There are only 10 types of people in the world, those who understand binary and those who don't-

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top