I have XmlDocument. I开发者_运维技巧 don't know XPath, I only know that this xml document has node named "h3" with attribute id="PortalName" and this attribute is unique for all xml document. How to find this node? I try:
XmlNode xnList = doc.SelectSingleNode("h3[@id='PortalName']");
but it does not work because it search only in root node. How to search in whole document? Thanks
Fortunately that's pretty easy:
XmlNode xnList = doc.SelectSingleNode("//h3[@id='PortalName']");
The "//h3" means "any h3 element in the whole document". (See the abbreviated syntax in the XPath spec for more information.)
精彩评论