内置.NET函数在XML流进行反向转义字符? [英] Built in .NET function for unescaping characters in XML stream?
本文介绍了内置.NET函数在XML流进行反向转义字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以,我在的形式,一些数据:
So, I have some data in the form of:
<foo><bar>test</bar></foo>
我想用将其转换为一些pretty的,并将其写入到一个文件看起来像这样什么.NET类/功能:
What .NET classes/functions would I want to use to convert this to something pretty and write it out to a file looking something like this:
<foo>
<bar>
test
</bar>
</foo>
为具体的的函数和类请,不只是用了System.XML。似乎有很多不同的方式使用XML做的事情在.NET:(
Be specific on the functions and classes please, not just "use System.XML". There seems to be a lot of different ways to do things in .NET using 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())
这篇关于内置.NET函数在XML流进行反向转义字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文