Built in .NET function for unescaping characters in XML stream?

后端 未结 4 2039
無奈伤痛
無奈伤痛 2020-12-20 12:06

So, I have some data in the form of:

<foo><bar>test</bar></foo>

What .NET classes/f

4条回答
  •  春和景丽
    2020-12-20 12:48

    Using the System.Xml.XmlDocument class...

    Dim Val As String = "<foo><bar>test</bar></foo>"
    Dim Xml As String = HttpUtility.HtmlDecode(Val)
    
    Dim Doc As New XmlDocument()
    Doc.LoadXml(Xml)
    
    Dim Writer As New StringWriter()
    Doc.Save(Writer)
    
    Console.Write(Writer.ToString())
    

提交回复
热议问题