XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("bk", "urn:samples"); //Select the book node with the matching attribute value. XmlNode book; XmlElement root = doc.DocumentElement; book = root.SelectSingleNode("descendant::book[@bk:ISBN='1-861001-57-6']", nsmgr);
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("bk", "urn:samples"); //Select the book node with the matching attribute value.
XmlNode book;
XmlElement root = doc.DocumentElement;
book = root.SelectSingleNode("descendant::book[@bk:ISBN='1-861001-57-6']", nsmgr);
XmlDocument doc = new XmlDocument();
doc.LoadXml(strinfo.Replace("gb2312", "UTF-8"));
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("msg", "http://roxbeam.com/RMS/DPC/Subscribe/XsPlaySource.xsd");
XmlElement root = doc.DocumentElement;
XmlNode node = root.SelectSingleNode("/msg:XsPlaySource/msg:OutputData/msg:PlaySources/msg:PlaySource", nsmgr);
Console.WriteLine(node.InnerText);