Cannot get XPath to work with unnamed namespace

toddyoung55

New Member
The XML (fragment):\[code\]<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetXMLResponse xmlns="http://sitecore.net/visual/"><GetXMLResult><sitecore xmlns=""><status>ok</status>\[/code\]The code (fragment):\[code\]XmlNamespaceManager nsManager = new XmlNamespaceManager(template.NameTable);nsManager.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");nsManager.PushScope();XmlNode sitecoreRoot = template.SelectSingleNode("/soap:Envelope/soap:Body/*[namespace-uri()='http://sitecore.net/visual/' and local-name()='GetXMLResponse']", nsManager);string status = sitecoreRoot.SelectSingleNode("/GetXMLResult/sitecore/status").Value;\[/code\]sitecoreRoot element returns the correct node. However the XPath to get the status always returns null, even though the siteCoreRoot.OuterXMl property shows the element is present.The only thing I can think of is the line:\[code\]<sitecore xmlns="">\[/code\]is throwing off the XPathTIA
 
Back
Top