加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

在XML中,调用了问号的节点是什么,如何在C#中添加它们?

发布时间:2020-12-16 07:55:42 所属栏目:百科 来源:网络整理
导读:以下是InfoPath中创建的 XML文件示例: ?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:MetastormSample%20ProceduresInfoPath%20samplesTemplat
以下是InfoPath中创建的 XML文件示例:
<?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:MetastormSample%20ProceduresInfoPath%20samplesTemplate1.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#中创建它们?

到目前为止我有这个:

XmlDocument xmldoc;
  XmlDeclaration xmlDeclaration;

  xmldoc=new XmlDocument();
  xmlDeclaration = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,"","") as XmlDeclaration;
  xmlDeclaration.Encoding = "UTF-8";
  xmldoc.AppendChild(xmlDeclaration);

这适用于顶级的XML声明节点,但如何创建接下来的两个?

提前致谢 :)

这些称为处理指令.使用 XmlDocument.CreateProcessingInstruction添加.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读