所以,我有以下形式的一些数据:
<foo><bar>test</bar></foo>
我想使用什么 .NET 类/函数将其转换为漂亮的东西并将其写出到如下所示的文件中:
<foo>
<bar>
test
</bar>
</foo>
请具体函数和类,而不仅仅是“使用 System.XML”。在 .NET 中似乎有很多不同的方法可以使用 XML 做事:(
谢谢
最佳答案
使用 System.Xml.XmlDocument
类...
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())
关于c# - 用于在 XML 流中取消转义字符的内置 .NET 函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2203485/