当前位置: 首页>>代码示例>>C#>>正文


C# IXmlDocument.CreateProcessingInstruction方法代码示例

本文整理汇总了C#中IXmlDocument.CreateProcessingInstruction方法的典型用法代码示例。如果您正苦于以下问题:C# IXmlDocument.CreateProcessingInstruction方法的具体用法?C# IXmlDocument.CreateProcessingInstruction怎么用?C# IXmlDocument.CreateProcessingInstruction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IXmlDocument的用法示例。


在下文中一共展示了IXmlDocument.CreateProcessingInstruction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateInstruction

    private void CreateInstruction(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName)
    {
      if (propertyName == DeclarationName)
      {
        string version = null;
        string encoding = null;
        string standalone = null;
        while (reader.Read() && reader.TokenType != JsonToken.EndObject)
        {
          switch (reader.Value.ToString())
          {
            case "@version":
              reader.Read();
              version = reader.Value.ToString();
              break;
            case "@encoding":
              reader.Read();
              encoding = reader.Value.ToString();
              break;
            case "@standalone":
              reader.Read();
              standalone = reader.Value.ToString();
              break;
            default:
              throw new JsonSerializationException("Unexpected property name encountered while deserializing XmlDeclaration: " + reader.Value);
          }
        }

        IXmlNode declaration = document.CreateXmlDeclaration(version, encoding, standalone);
        currentNode.AppendChild(declaration);
      }
      else
      {
        IXmlNode instruction = document.CreateProcessingInstruction(propertyName.Substring(1), reader.Value.ToString());
        currentNode.AppendChild(instruction);
      }
    }
开发者ID:284247028,项目名称:MvvmCross,代码行数:37,代码来源:XmlNodeConverter.cs

示例2: CreateInstruction

 // Token: 0x060006E9 RID: 1769
 // RVA: 0x00038868 File Offset: 0x00036A68
 private void CreateInstruction(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName)
 {
     if (propertyName == "?xml")
     {
         string version = null;
         string encoding = null;
         string standalone = null;
         while (reader.Read())
         {
             if (reader.TokenType == JsonToken.EndObject)
             {
                 break;
             }
             string a;
             if ((a = reader.Value.ToString()) != null)
             {
                 if (a == "@version")
                 {
                     reader.Read();
                     version = reader.Value.ToString();
                     continue;
                 }
                 if (a == "@encoding")
                 {
                     reader.Read();
                     encoding = reader.Value.ToString();
                     continue;
                 }
                 if (a == "@standalone")
                 {
                     reader.Read();
                     standalone = reader.Value.ToString();
                     continue;
                 }
             }
             throw new JsonSerializationException("Unexpected property name encountered while deserializing XmlDeclaration: " + reader.Value);
         }
         IXmlNode newChild = document.CreateXmlDeclaration(version, encoding, standalone);
         currentNode.AppendChild(newChild);
         return;
     }
     IXmlNode newChild2 = document.CreateProcessingInstruction(propertyName.Substring(1), reader.Value.ToString());
     currentNode.AppendChild(newChild2);
 }
开发者ID:newchild,项目名称:Project-DayZero,代码行数:46,代码来源:XmlNodeConverter.cs


注:本文中的IXmlDocument.CreateProcessingInstruction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。