Hi,
I'm trying to write some code to find a specific XmlNode object based on the URL in the XML sitemap but can't get it to find anything.
The sitemap is the standard ASP.net sitemap and contains:
<siteMapNode url="~/lev/index.aspx" title="Live-Eye-Views">
--- Child Items ---
</siteMapNode>
The code I'm using to search for the element is:
XmlDocument siteMapXml = new XmlDocument();
siteMapXml.Load(AppDomain.CurrentDomain.BaseDirectory + _siteMapFileName)
XmlNode levRoot = siteMapXml.SelectSingleNode("siteMapNode[@url=\"~/lev/index.aspx\"]");
The levRoot object is always null. When I break after the Load method, I can see all the elements in the XML file so it's loading as expected.
I've tried using single quotes in the XPath query but that didn't make any difference.
_siteMapFileName is set in the Initialize method and is pointing at the correct file.
Does anyone have any ideas what could be up with this or suggest another way to find a specific element by attribute?
Thanks,
Kev