|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
XmlDocument and XpathI have an XmlDocument instance, I want to find a node in the xml, but I don't know it's path until runtime, for example <aaa> <bbb name="x"/> <aaa attr="y"> <ccc>sometext</ccc> </aaa> </bbb> </aaa> sometime I will look for tag "aaa" (the root) sometime I will loof for tag bbb sometime I will look for tag the child aaa node (with attribute ="y") for now I am using the SelectSingleNode method and specify the xPath. But I don't know how can I found the desire node if I don't know the path. I've tried rootElement.SelectSingleNode("aaa[attribute::attr=\"y\"]", myNamespaceMgr); but it doesn't work. It only work if I specify the full path i.e aaa\bbb\aaa[attribute::attr=\"y\"], but in my case the path is dyanamic.... so my question is, given a node name and attributes (name and value), if any, how can I find a node in the xml doc from the root element (any method is ok, not necessary using xpath)? thanks first, Gnic |
|||||||||||||||||||||||