XmlNode.SelectSingleNode returns element outside current?

后端 未结 4 1681
梦谈多话
梦谈多话 2021-02-18 17:01

my problem is like this. Let\'s say i have xml like this


  
    Value1
    

        
4条回答
  •  庸人自扰
    2021-02-18 17:34

    The XPath expression you have isn't what you want.

    Replace it with this:

    node.SelectSingleNode( "element3" ); 
    

    And you'll get the result you're looking for.

提交回复
热议问题