Hello, I am a newbie in Xpath. I have an XML document containing routing table shown below. I have been strugling for days on how to write xpath query to extract <agenttype> and <pref> nodes which destination address <startbrigade> is 7 AND <start_node> is 252 :'( .
this is how i select out <pref> <agent type> and <start_node> in <brigade 7>
System.Xml.XmlNodeList RouteList = xmldoc.SelectNodes("//startbrigade[. = '7']/ancestor::node()/pref | //startbrigade[. = '7']/ancestor::node()/agenttype|//startbrigade[. = '7']/parent::node()/start_node")
but i want to further select out < pref >and <agenttype> which has <startnode> 252 only...
Could anyone help please ?
<entry>
<nextnode>
<briagade>7</briagade>
<node>252</node>
</nextnode>
<agenttype>13</agenttype>
<pref>3</pref>
<destinationaddress>
<startbrigade>7</startbrigade>
<startnode>252</startnode>
<endbrigade>7</endbrigade>
<endnode>252</endnode>
</destinationaddress>
</entry>
<entry>
<nextnode>
<briagade>7</briagade>
<node>253</node>
</nextnode>
<agenttype>12</agenttype>
<pref>1</pref>
<destinationaddress>
<startbrigade>7</startbrigade>
<startnode>253</startnode>
<endbrigade>7</endbrigade>
<endnode>253</endnode>
</destinationaddress>
</entry>
<entry>
<nextnode>
<briagade>7</briagade>
<node>253</node>
</nextnode>
<agenttype>12</agenttype>
<pref>1</pref>
<destinationaddress>
<startbrigade>7</startbrigade>
<startnode>253</startnode>
<endbrigade>7</endbrigade>
<endnode>253</endnode>
</destinationaddress>
</entry>
<entry>
<nextnode>
<briagade>7</briagade>
<node>253</node>
</nextnode>
<agenttype>12</agenttype>
<pref>1</pref>
<destinationaddress>
<startbrigade>8</startbrigade>
<startnode>253</startnode>
<endbrigade>8</endbrigade>
<endnode>253</endnode>
</destinationaddress>
</entry>
Any help are greatly appreciated..
Thank you in advance
kyu
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).