有关XML生成的帮助 [英] help regarding the Genaration of XML
本文介绍了有关XML生成的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人能告诉我如何在xml中生成此输出吗?
can any body tell me how can i generate this output in xml
<ACES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ACES_DLR.xsd">
推荐答案
使用字符串生成器类构建字符串(用反斜杠转义双引号)...
Use the string builder class to build the string (escaping the double-quotes with a backslash)...
StringBuilder sb;
sb.Append("<aces xmlns:xsi="\"http://www.w3.org/2001/XMLSchema-instance\"");<br" mode="hold" />sb.Append("xsi:noNamespaceSchemaLocation=\"ACES_DLR.xsd\">");
然后将其解析为XML文档
Then parse it into an XML Doc
XmlDocument _myXMLDoc;
_myXMLDoc.Load(sb.ToString);
或使用字符串生成器和StreamWriter类将其保存到文本文件中,然后将其命名为"myxmldoc.xml"
or use the string builder and the StreamWriter class to save it out to a text file and just name it "myxmldoc.xml"
System.IO.File.WriteAllText(@"C:\Users\Public\myxmldoc.xml", sb.ToString);
这篇关于有关XML生成的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文