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


C# XmlWriter.WriteNode方法代码示例

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


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

示例1: WriteXml

        public void WriteXml(XmlWriter xmlWriter)
        {

            if (wsdl != null)
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    wsdl.Write(ms);

                    XmlDictionaryReaderQuotas quota = new XmlDictionaryReaderQuotas();
                    quota.MaxDepth = 32;
                    quota.MaxStringContentLength = 8192;
                    quota.MaxArrayLength = 16384;
                    quota.MaxBytesPerRead = 4096;
                    quota.MaxNameTableCharCount = 16384;

                    ms.Seek(0, SeekOrigin.Begin);

                    XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(ms, null, quota, null);

                    if ((reader.MoveToContent() == XmlNodeType.Element) && (reader.Name == "wsdl:definitions"))
                    {

                        xmlWriter.WriteNode(reader, false);
                    }

                    reader.Close();
                }
            }

        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:31,代码来源:ComPlusDiagnosticTraceSchemas.cs

示例2: fillXml

 public void fillXml(XmlWriter xw)
 {
     using (XmlReader xr = XmlReader.Create(new StringReader(this.xmls)))
     {
         xr.ReadToFollowing(_xml_tag);
         xw.WriteNode(xr, false);
     }
 }
开发者ID:jango2015,项目名称:Ironclad,代码行数:8,代码来源:Presentation.cs

示例3: WriteXml

        public void WriteXml(XmlWriter writer)
        {
            writer.WriteAttributeString("index", index.ToString());

            if (template != null)
            {
                writer.WriteStartElement("template");
                writer.WriteNode(template.CreateReader(), true);
                writer.WriteEndElement();
            }
        }
开发者ID:nxkit,项目名称:nxkit,代码行数:11,代码来源:RepeatState.cs

示例4: CopyNode

			protected override void CopyNode(XmlReader reader, XmlWriter writer)
			{
				if (reader.NodeType == XmlNodeType.Element && reader.Name == "configuration")
				{
					writer.WriteStartElement("configuration");
					writer.WriteAttributeString("version", "2");
					reader.Read();
				} else
				{
					writer.WriteNode(reader, true);
				}
			}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:12,代码来源:XmlReaderWriterMigratorTests.cs

示例5: ExtractSdmxMessage

 /// <summary>
 /// Extract message from soap
 /// </summary>
 /// <param name="input">
 /// The input
 /// </param>
 /// <param name="writer">
 /// The writer
 /// </param>
 public static void ExtractSdmxMessage(Stream input, XmlWriter writer)
 {
     using (var reader = XmlReader.Create(input))
     {
         SdmxMessageUtil.FindSdmx(reader);
         if (reader.EOF)
         {
            return;
         }
       writer.WriteStartDocument();
       writer.WriteNode(reader, false);
     }
 }
开发者ID:SDMXISTATFRAMEWORK,项目名称:ISTAT_ENHANCED_SDMXRI_WS,代码行数:22,代码来源:SoapUtils.cs

示例6: using

        void IXmlSerializable.WriteXml(XmlWriter writer)
        {
            writer.WriteAttributeString("Title", this.Title);
            writer.WriteAttributeString("Row", this.Row.ToString());
            writer.WriteAttributeString("Column", this.Column.ToString());
            writer.WriteStartElement(XMLConstants.PROVISIONING_SCHEMA_PREFIX, "Contents", XMLConstants.PROVISIONING_SCHEMA_NAMESPACE_2015_12);

            using (XmlReader xr = new XmlNodeReader(this.Contents))
            {
                writer.WriteNode(xr, false);
            }

            writer.WriteEndElement();
        }
开发者ID:LiyeXu,项目名称:PnP-Sites-Core,代码行数:14,代码来源:ProvisioningSchema-2015-12.extensions.cs

示例7: WriteTo

 public override void WriteTo(XmlWriter writer)
 {
     XmlReader r;
     lock (this)
     {
         if (_reader == null) throw new Exception("The XmlReader has already been opened once and cannot be reset.");
         r = _reader;
         _reader = null;
     }
     if (r.ReadState == ReadState.Initial)
         r.Read();
     while (!r.EOF)
         writer.WriteNode(r, true);
 }
开发者ID:bittercoder,项目名称:Lob,代码行数:14,代码来源:XmlReaderXlob.cs

示例8: WriteAttributeValue

 //public CustomSaml2SecurityTokenHandler(SecurityTokenHandlerConfiguration configuration)
 //{
 //    SecurityTokenHandlerConfiguration handlerConfig = configuration ?? new SecurityTokenHandlerConfiguration
 //    {
 //        AudienceRestriction = {AudienceMode = AudienceUriMode.Never},
 //        CertificateValidationMode = X509CertificateValidationMode.None,
 //        RevocationMode = X509RevocationMode.NoCheck,
 //        MaxClockSkew = new TimeSpan(50000000),
 //        CertificateValidator = X509CertificateValidator.None
 //    };
 //    Configuration = handlerConfig;
 //}
 //public CustomSaml2SecurityTokenHandler()
 //    : this(null)
 //{
 //}
 protected override void WriteAttributeValue(XmlWriter writer, string value, Saml2Attribute attribute)
 {
     var sb = new StringBuilder("<a>");
     sb.Append(value);
     sb.Append("</a>");
     byte[] rawValue = new UTF8Encoding().GetBytes(sb.ToString());
     using (
         XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(rawValue,
             XmlDictionaryReaderQuotas.Max))
     {
         reader.ReadStartElement("a");
         while (reader.NodeType != XmlNodeType.EndElement ||
                (reader.NodeType == XmlNodeType.EndElement && reader.Name != "a"))
         {
             writer.WriteNode(reader, false);
         }
         reader.ReadEndElement();
         reader.Close();
     }
 }
开发者ID:CommonWell,项目名称:CommonWell-Token,代码行数:36,代码来源:CustomSaml2SecurityTokenHandler.cs

示例9: SerializeToXmlElement

        protected override bool SerializeToXmlElement(XmlWriter writer, String elementName)
        {
            bool dataToWrite = this.XmlElement != null;
            if (dataToWrite && writer != null)
            {
                if (!String.Equals(elementName, ConfigurationStrings.XmlElement, StringComparison.Ordinal))
                {
                    writer.WriteStartElement(elementName);
                }

                using (XmlNodeReader reader = new XmlNodeReader(this.XmlElement))
                {
                    writer.WriteNode(reader, false);
                }

                if (!String.Equals(elementName, ConfigurationStrings.XmlElement, StringComparison.Ordinal))
                {
                    writer.WriteEndElement();
                }
            }
            return dataToWrite;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:22,代码来源:XmlElementElement.cs

示例10: SignForm

        private bool SignForm(XmlReader reader, XmlWriter writer)
        {
            if (!reader.IsStartElement("model"))
            {
                return false;
            }

            var doc = XDocument.Load(reader.ReadSubtree());
            var formContents = GetFormContents(doc);
            var submission = GetSubmission(doc);

            if (submission != null)
            {
                submission.Element.SetAttributeValue("resource", submission.TargetUri.Replace(signaturePlaceholder, signature.GenerateSignature(formContents)));
            }

            reader.ReadEndElement();
            writer.WriteNode(doc.CreateReader(), false);
            writer.Flush();

            return true;
        }
开发者ID:iansrobinson,项目名称:Restbucks,代码行数:22,代码来源:FormsIntegrityUtility.cs

示例11: WriteXml

 public void WriteXml(XmlWriter xmlWriter)
 {
     if (this.wsdl != null)
     {
         using (MemoryStream stream = new MemoryStream())
         {
             this.wsdl.Write(stream);
             XmlDictionaryReaderQuotas quotas = new XmlDictionaryReaderQuotas {
                 MaxDepth = 0x20,
                 MaxStringContentLength = 0x2000,
                 MaxArrayLength = 0x4000,
                 MaxBytesPerRead = 0x1000,
                 MaxNameTableCharCount = 0x4000
             };
             stream.Seek(0L, SeekOrigin.Begin);
             XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(stream, null, quotas, null);
             if ((reader.MoveToContent() == XmlNodeType.Element) && (reader.Name == "wsdl:definitions"))
             {
                 xmlWriter.WriteNode(reader, false);
             }
             reader.Close();
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:24,代码来源:WsdlWrapper.cs

示例12: WriteTo

			public override void WriteTo(XmlWriter w)
			{
				w.WriteNode(_navigator.ReadSubtree(), false);
			}
开发者ID:kisflying,项目名称:kion,代码行数:4,代码来源:XmlNodeFactory.cs

示例13: WriteXml

		/// <summary>
		/// See <see cref="IXmlSerializable.WriteXml"/>.
		/// </summary>
		public void WriteXml(XmlWriter writer)
		{
			writer.WriteNode(this, false);
		}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:7,代码来源:XPathIteratorReader.cs

示例14: InvokeMethod

 private void InvokeMethod(XmlWriter w, string methodName)
 {
     byte[] buffer = new byte[10];
     switch (methodName)
     {
         case "WriteStartDocument":
             w.WriteStartDocument();
             break;
         case "WriteStartElement":
             w.WriteStartElement("root");
             break;
         case "WriteEndElement":
             w.WriteEndElement();
             break;
         case "WriteStartAttribute":
             w.WriteStartAttribute("attr");
             break;
         case "WriteEndAttribute":
             w.WriteEndAttribute();
             break;
         case "WriteCData":
             w.WriteCData("test");
             break;
         case "WriteComment":
             w.WriteComment("test");
             break;
         case "WritePI":
             w.WriteProcessingInstruction("name", "test");
             break;
         case "WriteEntityRef":
             w.WriteEntityRef("e");
             break;
         case "WriteCharEntity":
             w.WriteCharEntity('c');
             break;
         case "WriteSurrogateCharEntity":
             w.WriteSurrogateCharEntity('\uDC00', '\uDBFF');
             break;
         case "WriteWhitespace":
             w.WriteWhitespace(" ");
             break;
         case "WriteString":
             w.WriteString("foo");
             break;
         case "WriteChars":
             char[] charArray = new char[] { 'a', 'b', 'c', 'd' };
             w.WriteChars(charArray, 0, 3);
             break;
         case "WriteRaw":
             w.WriteRaw("<foo>bar</foo>");
             break;
         case "WriteBase64":
             w.WriteBase64(buffer, 0, 9);
             break;
         case "WriteBinHex":
             w.WriteBinHex(buffer, 0, 9);
             break;
         case "LookupPrefix":
             string str = w.LookupPrefix("foo");
             break;
         case "WriteNmToken":
             w.WriteNmToken("foo");
             break;
         case "WriteName":
             w.WriteName("foo");
             break;
         case "WriteQualifiedName":
             w.WriteQualifiedName("foo", "bar");
             break;
         case "WriteValue":
             w.WriteValue(Int32.MaxValue);
             break;
         case "WriteAttributes":
             XmlReader xr1 = ReaderHelper.Create(new StringReader("<root attr='test'/>"));
             xr1.Read();
             w.WriteAttributes(xr1, false);
             break;
         case "WriteNodeReader":
             XmlReader xr2 = ReaderHelper.Create(new StringReader("<root/>"));
             xr2.Read();
             w.WriteNode(xr2, false);
             break;
         case "Flush":
             w.Flush();
             break;
         default:
             CError.Equals(false, "Unexpected param in testcase: {0}", methodName);
             break;
     }
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:90,代码来源:CommonTests.cs

示例15: WriteFeed

        /// <summary>
        /// Called by the runtime when all entities are written and contents needs to flushed to the underlying stream.
        /// </summary>
        /// <param name="writer">XmlWriter to which this feed will be serialized to</param>
        public override void WriteFeed(XmlWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            _document.Add(_root);

            // Write the </feed> end element.
            writer.WriteNode(_document.CreateReader(), true);
            writer.Flush();
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:17,代码来源:ODataAtomWriter.cs


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