C# 在文本框中显示格式化的 xml
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16894661/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
show formatted xml in textbox
提问by DarkW1nter
I've been searching for a way to show formatted xml in a textbox, everything I've found so far points towards reading in xml from a file and formatting that, however I want to show xml which is held in a database field.
我一直在寻找一种在文本框中显示格式化 xml 的方法,到目前为止我发现的所有内容都指向从文件中读取 xml 并对其进行格式化,但是我想显示保存在数据库字段中的 xml。
The idea is that a user will have records returned to a gridview, the gridview will show everything apart from the xml message due to its size. They can then select the record and show the xml on a pop-up form.
这个想法是用户将记录返回到 gridview,gridview 由于其大小将显示除 xml 消息之外的所有内容。然后他们可以选择记录并在弹出表单上显示 xml。
I have the xml passed to the pop-up form, just not sure how to handle it. Any ideas welcome.
我已将 xml 传递给弹出窗体,只是不知道如何处理它。欢迎任何想法。
回答by DarkW1nter
Got round it by using
通过使用绕过它
xmlOut = System.Xml.Linq.XDocument.Parse(txtXml).ToString();

