在XML中,什么是带有问号称为节点,以及我如何在C#中添加它们? [英] In XML, what are the nodes with question marks called, and how do I add them in C#?
本文介绍了在XML中,什么是带有问号称为节点,以及我如何在C#中添加它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是在InfoPath创建的XML文件的例子:
Here's an example of an XML file created in InfoPath:
<?xml version="1.0" encoding="UTF-8"?>
<?mso-infoPathSolution solutionVersion="1.0.0.1" productVersion="12.0.0" PIVersion="1.0.0.0" href="file:///C:\Metastorm\Sample%20Procedures\InfoPath%20samples\Template1.xsn" name="urn:schemas-microsoft-com:office:infopath:Template1:-myXSD-2010-07-21T14-21-13" ?>
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?>
<my:myFields xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-07-21T14:21:13" xml:lang="en-us">
<my:field1>hello</my:field1>
<my:field2>world</my:field2>
</my:myFields>
什么是与所谓的问号那些顶级3个节点......,我如何在创建它们?C#
What are those top 3 nodes with the question mark called... and how do I create them in C#?
到目前为止,我有这样的:
So far I have this:
XmlDocument xmldoc;
XmlDeclaration xmlDeclaration;
xmldoc=new XmlDocument();
xmlDeclaration = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, "", "") as XmlDeclaration;
xmlDeclaration.Encoding = "UTF-8";
xmldoc.AppendChild(xmlDeclaration);
这工作正常的顶级XML声明节点,但我怎么创造未来两年?
This works fine for the top XML declaration node , but how do I create the next two?
感谢:)
推荐答案
这些被称为处理指令。使用 XmlDocument.CreateProcessingInstruction 添加他们。
These are called processing instructions. Add 'em using XmlDocument.CreateProcessingInstruction.
这篇关于在XML中,什么是带有问号称为节点,以及我如何在C#中添加它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文