XPath doesn't work as desired in C#

前端 未结 2 1809
名媛妹妹
名媛妹妹 2020-12-14 23:34

My code doesn\'t return the node

XmlDocument xml = new XmlDocument();
xml.InnerXml = text;

XmlNode node_ =  xml.SelectSingleNode(node);
return node_.InnerT         


        
2条回答
  •  粉色の甜心
    2020-12-15 00:36

    Sorry for the late reply but I had a similar problem just a moment ago.

    if you REALLY want to ignore that namespace then just delete it from the string you use to initialise the XmlDocument

    text=text.Replace(
    "",
    "");
    
    XmlDocument xml = new XmlDocument();
    xml.InnerXml = text;
    
    XmlNode node_ =  xml.SelectSingleNode(node);
    return node_.InnerText;
    

提交回复
热议问题