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


C# XmlWriter.WriteProcessingInstruction方法代码示例

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


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

示例1: WriteResponseMessage

        public void WriteResponseMessage ( XmlWriter writer, string innerXml, NuxleusAsyncResult asyncResult ) {

            using (writer) {
                writer.WriteStartDocument();
                if (m_responseType == ResponseType.REDIRECT) {
                    writer.WriteProcessingInstruction("xml-stylesheet", "type='text/xsl' href='/service/transform/openid-redirect.xsl'");
                }
                writer.WriteStartElement("auth");
                writer.WriteAttributeString("xml:base", "http://dev.amp.fm/");
                writer.WriteAttributeString("status", m_status);
                if (m_responseType == ResponseType.REDIRECT) {
                    writer.WriteElementString("url", "http://dev.amp.fm/");
                }
                if (m_responseType == ResponseType.QUERY_RESPONSE && innerXml != null) {
                    writer.WriteStartElement("response");
                    writer.WriteRaw(innerXml);
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
                writer.WriteEndDocument();
            }

            asyncResult.CompleteCall();

        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:25,代码来源:Message.cs

示例2: WriteNode

 private static void WriteNode(XmlReader reader, XmlWriter writer)
 {
     while (reader.Read())
     {
         switch (reader.NodeType)
         {
         case XmlNodeType.Element:
             writer.WriteStartElement(reader.Name);
             break;
         case XmlNodeType.Text:
             writer.WriteString(reader.Value);
             break;
         case XmlNodeType.CDATA:
             writer.WriteCData(reader.Value);
             break;
         case XmlNodeType.ProcessingInstruction:
             writer.WriteProcessingInstruction(reader.Name, reader.Value);
             break;
         case XmlNodeType.Comment:
             writer.WriteComment(reader.Value);
             break;
         case XmlNodeType.XmlDeclaration:
             break;
         case XmlNodeType.Document:
             break;
         case XmlNodeType.DocumentType:
             break;
         case XmlNodeType.EntityReference:
             break;
         case XmlNodeType.EndElement:
             writer.WriteEndElement();
             break;
         }
     }
 }
开发者ID:platformdotnet,项目名称:Platform,代码行数:35,代码来源:XmlNodeNodeTypeSerializer.cs

示例3: WriteTo

 public override void WriteTo(XmlWriter writer)
 {
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     writer.WriteProcessingInstruction(this.target, this.data);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:XProcessingInstruction.cs

示例4: WriteIncludes

 private static void WriteIncludes(LocalizationDictionary dictionary, XmlWriter writer) {
   foreach(var include in dictionary.Includes) {
     var data = "include=\""+include.Path+"\"";
     if(!String.IsNullOrEmpty(include.Prefix)) {
       data += " prefix=\""+include.Prefix+"\"";
     }
     writer.WriteProcessingInstruction("mios-localization", data);
   }
 }
开发者ID:mios-fi,项目名称:mios.localization,代码行数:9,代码来源:XmlLocalizationWriter.cs

示例5: WriteTo

        /// <summary>
        /// Saves the current node to the specified XmlWriter.
        /// </summary>
        /// <param name="writer">The XmlWriter to which you want to save.</param>
        public override void WriteTo(XmlWriter writer)
        {
            writer.WriteProcessingInstruction("xml", string.Format("version=\"1.0\" encoding=\"{0}\"", EncodingName()));

            if (HasChildNodes)
            {
                foreach (HtmlNode subnode in ChildNodes)
                {
                    subnode.WriteTo(writer);
                }
            }
        }
开发者ID:ToFuKing,项目名称:HtmlAgilityPack,代码行数:16,代码来源:HtmlDocumentNode.cs

示例6: WriteShallowNode

        private static void WriteShallowNode(XmlReader reader, XmlWriter writer)
        {
            switch (reader.NodeType)
            {
                case XmlNodeType.Element:
                    writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
                    writer.WriteAttributes(reader, true);
                    if (reader.IsEmptyElement)
                    {
                        writer.WriteEndElement();
                    }
                    return;

                case XmlNodeType.Text:
                    writer.WriteString(reader.Value);
                    return;

                case XmlNodeType.CDATA:
                    writer.WriteCData(reader.Value);
                    return;

                case XmlNodeType.ProcessingInstruction:
                    writer.WriteProcessingInstruction(reader.Name, reader.Value);
                    return;

                case XmlNodeType.Comment:
                    writer.WriteComment(reader.Value);
                    return;

                case XmlNodeType.DocumentType:
                    writer.WriteDocType(reader.Name, reader.GetAttribute("PUBLIC"), reader.GetAttribute("SYSTEM"), reader.Value);
                    return;

                case XmlNodeType.Whitespace:
                    writer.WriteWhitespace(reader.Value);
                    return;

                case XmlNodeType.SignificantWhitespace:
                    writer.WriteWhitespace(reader.Value);
                    return;

                case XmlNodeType.EndElement:
                    writer.WriteFullEndElement();
                    return;

                case XmlNodeType.XmlDeclaration:
                    writer.WriteProcessingInstruction(reader.Name, reader.Value);
                    return;
            }
            throw new InvalidOperationException("Invalid node");
        }
开发者ID:iansrobinson,项目名称:Restbucks,代码行数:51,代码来源:XmlTransform.cs

示例7: GeneratePracticeInfo

		///<summary>Generates all the xml up to the point where the first statement would go.</summary>
		public static void GeneratePracticeInfo(XmlWriter writer) {
			writer.WriteProcessingInstruction("xml","version = \"1.0\" standalone=\"yes\"");
			writer.WriteStartElement("StatementFile");
			//sender address----------------------------------------------------------
			writer.WriteStartElement("SenderAddress");
			writer.WriteElementString("Name",PrefC.GetString(PrefName.PracticeTitle));
			writer.WriteElementString("Address1",PrefC.GetString(PrefName.PracticeAddress));
			writer.WriteElementString("Address2",PrefC.GetString(PrefName.PracticeAddress2));
			writer.WriteElementString("City",PrefC.GetString(PrefName.PracticeCity));
			writer.WriteElementString("State",PrefC.GetString(PrefName.PracticeST));
			writer.WriteElementString("Zip",PrefC.GetString(PrefName.PracticeZip));
			writer.WriteElementString("Phone",PrefC.GetString(PrefName.PracticePhone));//enforced to be 10 digit fairly rigidly by the UI
			writer.WriteEndElement();//SenderAddress
			writer.WriteStartElement("Statements");
		}
开发者ID:mnisl,项目名称:OD,代码行数:16,代码来源:ClaimX_Statements.cs

示例8: Build

        public void Build(XmlWriter writer)
        {
            writer.WriteProcessingInstruction("xml-stylesheet", "type='text/xsl' href='style.xsl'");
            writer.WriteStartElement("types");
            this.DumpApiDocs(writer, "target", "NLog.Targets.TargetAttribute", "", " target");
            this.DumpApiDocs(writer, "layout", "NLog.Layouts.LayoutAttribute", "", "");
            this.DumpApiDocs(writer, "layout-renderer", "NLog.LayoutRenderers.LayoutRendererAttribute", "${", "}");
            this.DumpApiDocs(writer, "filter", "NLog.Filters.FilterAttribute", "", " filter");

            this.DumpApiDocs(writer, "target", "NLog.TargetAttribute", "", " target");
            this.DumpApiDocs(writer, "layout", "NLog.LayoutAttribute", "", "");
            this.DumpApiDocs(writer, "layout-renderer", "NLog.LayoutRendererAttribute", "${", "}");
            this.DumpApiDocs(writer, "filter", "NLog.FilterAttribute", "", " filter");
            writer.WriteEndElement();
        }
开发者ID:semirs,项目名称:CellAO,代码行数:15,代码来源:DocFileBuilder.cs

示例9: GeneratePracticeInfo

		//these are temporary:
		//private static string vendorID="68";
		//private static string vendorPMScode="144";
		//private static string clientAccountNumber="8011";//the dental office number set by EHG
		//private static string creditCardChoices="MC,D,V,A";//MasterCard,Discover,Visa,AmericanExpress
		//private static string userName="";
		//private static string password="";

		///<summary>Generates all the xml up to the point where the first statement would go.</summary>
		public static void GeneratePracticeInfo(XmlWriter writer) {
			writer.WriteProcessingInstruction("xml","version = \"1.0\" standalone=\"yes\"");
			writer.WriteStartElement("EISStatementFile");
			writer.WriteAttributeString("VendorID",PrefC.GetString(PrefName.BillingElectVendorId));
			writer.WriteAttributeString("OutputFormat","StmOut_Blue6Col");
			writer.WriteAttributeString("Version","2");
			writer.WriteElementString("SubmitDate",DateTime.Today.ToString("yyyy-MM-dd"));
			writer.WriteElementString("PrimarySubmitter",PrefC.GetString(PrefName.BillingElectVendorPMSCode));
			writer.WriteElementString("Transmitter","EHG");
			writer.WriteStartElement("Practice");
			writer.WriteAttributeString("AccountNumber",PrefC.GetString(PrefName.BillingElectClientAcctNumber));
			//sender address----------------------------------------------------------
			writer.WriteStartElement("SenderAddress");
			writer.WriteElementString("Name",PrefC.GetString(PrefName.PracticeTitle));
			writer.WriteElementString("Address1",PrefC.GetString(PrefName.PracticeAddress));
			writer.WriteElementString("Address2",PrefC.GetString(PrefName.PracticeAddress2));
			writer.WriteElementString("City",PrefC.GetString(PrefName.PracticeCity));
			writer.WriteElementString("State",PrefC.GetString(PrefName.PracticeST));
			writer.WriteElementString("Zip",PrefC.GetString(PrefName.PracticeZip));
			writer.WriteElementString("Phone",PrefC.GetString(PrefName.PracticePhone));//enforced to be 10 digit fairly rigidly by the UI
			writer.WriteEndElement();//senderAddress
			//remit address----------------------------------------------------------
			writer.WriteStartElement("RemitAddress");
			writer.WriteElementString("Name",PrefC.GetString(PrefName.PracticeTitle));
			if(PrefC.GetString(PrefName.PracticeBillingAddress)=="") {//same as sender address
				writer.WriteElementString("Address1",PrefC.GetString(PrefName.PracticeAddress));
				writer.WriteElementString("Address2",PrefC.GetString(PrefName.PracticeAddress2));
				writer.WriteElementString("City",PrefC.GetString(PrefName.PracticeCity));
				writer.WriteElementString("State",PrefC.GetString(PrefName.PracticeST));
				writer.WriteElementString("Zip",PrefC.GetString(PrefName.PracticeZip));
			}
			else {
				writer.WriteElementString("Address1",PrefC.GetString(PrefName.PracticeBillingAddress));
				writer.WriteElementString("Address2",PrefC.GetString(PrefName.PracticeBillingAddress2));
				writer.WriteElementString("City",PrefC.GetString(PrefName.PracticeBillingCity));
				writer.WriteElementString("State",PrefC.GetString(PrefName.PracticeBillingST));
				writer.WriteElementString("Zip",PrefC.GetString(PrefName.PracticeBillingZip));				
			}
			writer.WriteElementString("Phone",PrefC.GetString(PrefName.PracticePhone));//phone is same in either case
			writer.WriteEndElement();//remitAddress
			//Rendering provider------------------------------------------------------
			Provider prov=Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv));
			writer.WriteStartElement("RenderingProvider");
			writer.WriteElementString("Name",prov.GetFormalName());
			writer.WriteElementString("LicenseNumber",prov.StateLicense);
			writer.WriteElementString("State",PrefC.GetString(PrefName.PracticeST));
			writer.WriteEndElement();//Rendering provider
		}
开发者ID:mnisl,项目名称:OD,代码行数:57,代码来源:EHG_statements.cs

示例10: WriteNodeSingle

    private void WriteNodeSingle(XmlReader reader, XmlWriter writer) {
      Contract.Requires(reader != null);
      Contract.Requires(writer != null);

      switch (reader.NodeType) {
        case XmlNodeType.Element:
          this.WriteElement(reader, writer);
          break;
        case XmlNodeType.Text:
          this.WriteText(reader, writer);
          break;
        case XmlNodeType.Whitespace:
        case XmlNodeType.SignificantWhitespace:
          this.WriteWhitespace(reader, writer);
          break;
        case XmlNodeType.CDATA:
          this.WriteCDATA(reader, writer);
          break;
        case XmlNodeType.EntityReference:
          Contract.Assume(false, "entityref not supported");
          writer.WriteString(reader.Name);
          break;
        case XmlNodeType.XmlDeclaration:
        case XmlNodeType.ProcessingInstruction:
          var pinstr = reader.Name;
          Contract.Assume(!String.IsNullOrEmpty(pinstr));
          writer.WriteProcessingInstruction(pinstr, reader.Value);
          break;
        case XmlNodeType.DocumentType:
          writer.WriteDocType(
              reader.Name,
              reader.GetAttribute("PUBLIC"),
              reader.GetAttribute("SYSTEM"),
              reader.Value);
          break;
        case XmlNodeType.Comment:
          WriteComment(reader, writer);
          break;
        case XmlNodeType.EndElement:
          this.WriteEndElement(reader, writer);
          break;
      }
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:43,代码来源:XmlTraverserBase.cs

示例11: AddStyleSheets

        public void AddStyleSheets(XmlWriter xmlWriter, IHasStyleSheets model)
        {
            if (model.StyleSheets == null)
            {
                return;
            }

            foreach (var styleSheet in model.StyleSheets)
            {
                StringBuilder stringBuilder = new StringBuilder([email protected]"type=""{styleSheet.Type}"" href=""{styleSheet.Url}""");

                WriteAttribute(stringBuilder, "title", styleSheet.Title);
                WriteAttribute(stringBuilder, "media", styleSheet.Media);
                WriteAttribute(stringBuilder, "charset", styleSheet.Charset);

                if (styleSheet.Alternate.HasValue && styleSheet.Alternate.Value != YesNo.None)
                {
                    WriteAttribute(stringBuilder, "alternate", styleSheet.Alternate.Value.ToString().ToLowerInvariant());
                }

                xmlWriter.WriteProcessingInstruction("xml-stylesheet", stringBuilder.ToString());
            }
        }
开发者ID:uhaciogullari,项目名称:SimpleMvcSitemap,代码行数:23,代码来源:XmlProcessingInstructionHandler.cs

示例12: WriteTo

 // Saves the node to the specified XmlWriter.
 public override void WriteTo(XmlWriter w) {
     w.WriteProcessingInstruction(target, data);
 }
开发者ID:uQr,项目名称:referencesource,代码行数:4,代码来源:XmlProcessingInstruction.cs

示例13: WriteSiteMapHeader

 internal void WriteSiteMapHeader(XmlWriter writer)
 {
     //start off the site map
     writer.WriteProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\"");
     writer.WriteStartElement("urlset");
     writer.WriteAttributeString("xmlns", "http://www.google.com/schemas/sitemap/0.9");
 }
开发者ID:martijnboland,项目名称:Cuyahoga-Constructor,代码行数:7,代码来源:SitemapHandler.cs

示例14: WriteShallowNode

        /* -------------------------------------------------------------------------------------
        * Name:  WriteShallowNode
        * Goal:  Copy piece-by-piece
        * History:
        * 2/oct/2015 ERK Created
          ------------------------------------------------------------------------------------- */
        public void WriteShallowNode(XmlReader reader, XmlWriter writer)
        {
            if (reader == null) {
            throw new ArgumentNullException("reader");
              }
              if (writer == null) {
            throw new ArgumentNullException("writer");
              }
              try {
            switch (reader.NodeType) {
              case XmlNodeType.Element:
            writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
            bool bIsFOLIA = (reader.LocalName == "FoLiA");
            string sLocalName = reader.LocalName;
            // Process attributes one by one
            if (reader.HasAttributes) {
              if (reader.MoveToFirstAttribute()) {
                do {
                  if (reader.Name != "xmlns") {
                    bool bWritten = false;
                    // Action depends on local name
                    switch (sLocalName) {
                      case "FoLiA":
                        // Is the the attribute @version?
                        if (reader.Name == "version") { writer.WriteAttributeString(reader.Name, FOLIA_VERSION); bWritten = true; }
                        break;
                      case "t":
                        // is this the attribute @class?
                        if (reader.Name == "class") { writer.WriteAttributeString(reader.Name, "eng"); bWritten = true; }
                        break;
                    }
                    if (!bWritten) {
                      String[] arName = reader.Name.Split(':');
                      if (arName.Length > 1) {
                        writer.WriteAttributeString(arName[0], arName[1], null, reader.Value);

                      } else {
                        writer.WriteAttributeString(reader.Name, reader.Value);
                      }
                    }
                    /*
                    // Check for FoLiA version
                    if (bIsFOLIA && reader.Name == "version") {
                      // Adapt version number
                      writer.WriteAttributeString(reader.Name, FOLIA_VERSION);
                    } else {
                      String[] arName = reader.Name.Split(':');
                      if (arName.Length > 1) {
                        writer.WriteAttributeString(arName[0], arName[1], null, reader.Value);

                      } else {
                        writer.WriteAttributeString(reader.Name, reader.Value);
                      }
                    } */
                  }
                } while (reader.MoveToNextAttribute());
              }
            }

            if (reader.IsEmptyElement) {
              writer.WriteEndElement();
            }
            break;
              case XmlNodeType.Text:
            writer.WriteString(reader.Value);
            break;
              case XmlNodeType.Whitespace:
              case XmlNodeType.SignificantWhitespace:
            writer.WriteWhitespace(reader.Value);
            break;
              case XmlNodeType.CDATA:
            writer.WriteCData(reader.Value);
            break;
              case XmlNodeType.EntityReference:
            writer.WriteEntityRef(reader.Name);
            break;
              case XmlNodeType.XmlDeclaration:
              case XmlNodeType.ProcessingInstruction:
            writer.WriteProcessingInstruction(reader.Name, reader.Value);
            break;
              case XmlNodeType.DocumentType:
            writer.WriteDocType(reader.Name, reader.GetAttribute("PUBLIC"), reader.GetAttribute("SYSTEM"), reader.Value);
            break;
              case XmlNodeType.Comment:
            writer.WriteComment(reader.Value);
            break;
              case XmlNodeType.EndElement:
            writer.WriteFullEndElement();
            break;
            }
              } catch (Exception ex) {
            errHandle.DoError("WriteShallowNode", ex); // Provide standard error message
              }
        }
开发者ID:ErwinKomen,项目名称:subtiel,代码行数:100,代码来源:xmlTools.cs

示例15: BuildSubtree

        internal void BuildSubtree(XmlReader reader, XmlWriter writer)
        {
            string ns = "http://www.w3.org/2000/xmlns/";
            ReadState readState = reader.ReadState;
            if ((readState != ReadState.Initial) && (readState != ReadState.Interactive))
            {
                throw new ArgumentException(Res.GetString("Xml_InvalidOperation"), "reader");
            }
            int num = 0;
            if (readState == ReadState.Initial)
            {
                if (!reader.Read())
                {
                    return;
                }
                num++;
            }
            do
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                    {
                        writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
                        bool isEmptyElement = reader.IsEmptyElement;
                        while (reader.MoveToNextAttribute())
                        {
                            if (reader.NamespaceURI == ns)
                            {
                                if (reader.Prefix.Length == 0)
                                {
                                    writer.WriteAttributeString("", "xmlns", ns, reader.Value);
                                }
                                else
                                {
                                    writer.WriteAttributeString("xmlns", reader.LocalName, ns, reader.Value);
                                }
                            }
                            else
                            {
                                writer.WriteStartAttribute(reader.Prefix, reader.LocalName, reader.NamespaceURI);
                                writer.WriteString(reader.Value);
                                writer.WriteEndAttribute();
                            }
                        }
                        reader.MoveToElement();
                        if (isEmptyElement)
                        {
                            writer.WriteEndElement();
                        }
                        else
                        {
                            num++;
                        }
                        break;
                    }
                    case XmlNodeType.Attribute:
                        if (reader.NamespaceURI != ns)
                        {
                            writer.WriteStartAttribute(reader.Prefix, reader.LocalName, reader.NamespaceURI);
                            writer.WriteString(reader.Value);
                            writer.WriteEndAttribute();
                            break;
                        }
                        if (reader.Prefix.Length != 0)
                        {
                            writer.WriteAttributeString("xmlns", reader.LocalName, ns, reader.Value);
                            break;
                        }
                        writer.WriteAttributeString("", "xmlns", ns, reader.Value);
                        break;

                    case XmlNodeType.Text:
                    case XmlNodeType.CDATA:
                        writer.WriteString(reader.Value);
                        break;

                    case XmlNodeType.EntityReference:
                        reader.ResolveEntity();
                        break;

                    case XmlNodeType.ProcessingInstruction:
                        writer.WriteProcessingInstruction(reader.LocalName, reader.Value);
                        break;

                    case XmlNodeType.Comment:
                        writer.WriteComment(reader.Value);
                        break;

                    case XmlNodeType.Whitespace:
                    case XmlNodeType.SignificantWhitespace:
                        writer.WriteString(reader.Value);
                        break;

                    case XmlNodeType.EndElement:
                        writer.WriteFullEndElement();
                        num--;
                        break;
                }
            }
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:XPathNavigator.cs


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