[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

Xpath for child nodelist

Asked by priyananth in XPath, Microsoft Visual C#.Net, Programming for ASP.NET

Tags: xpath, xml, c#, asp.net

<root>
<child id = 1> <subroot> <element id = 1 /> </subroot> </child>
<child  id = 2 > <subroot> <element id = 2 /> </subroot> </child>
<child id = 3> <subroot> <element id = 3 /> </subroot> </child>
<child id =4 > <subroot> <element id = 4 /> </subroot> </child>
<child id = 5> <subroot> <element id = 5 /> </subroot> </child>
<child id =6> <subroot> <element id = 6 /> </subroot> </child>
</root>

In the above xml, I need to get the "child" nodes and again needs to query the subroot nodes using xpath.

xpath to get child node :
XmlNodelist child = doc.SelectNodes("//root/child")

foreach(XmlNode item in XmlNodeList)
{
     item.selectnodes(//subroot/);  //hereafter  this should be taken as root node
}

but the second xpath query, again searches  from root node. how set the child node as root?

 
[+][-]11/07/09 11:34 PM, ID: 25769697Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/15/09 07:26 PM, ID: 25827660Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/15/09 10:46 PM, ID: 25828227Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/16/09 06:30 AM, ID: 25830469Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625