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


C# XmlDictionaryWriter.WriteAttributes方法代码示例

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


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

示例1: OnWriteStartAddressHeader

 protected override void OnWriteStartAddressHeader(XmlDictionaryWriter writer)
 {
     XmlDictionaryReader addressHeaderReader = this.GetAddressHeaderReader();
     writer.WriteStartElement(addressHeaderReader.Prefix, addressHeaderReader.LocalName, addressHeaderReader.NamespaceURI);
     writer.WriteAttributes(addressHeaderReader, false);
     addressHeaderReader.Close();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:BufferedAddressHeader.cs

示例2: OnWriteStartHeader

 protected override void OnWriteStartHeader(XmlDictionaryWriter writer, MessageVersion messageVersion)
 {
     if (!this.IsMessageVersionSupported(messageVersion))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("MessageHeaderVersionNotSupported", new object[] { base.GetType().FullName, messageVersion.ToString() }), "version"));
     }
     XmlDictionaryReader headerReader = this.GetHeaderReader();
     writer.WriteStartElement(headerReader.Prefix, headerReader.LocalName, headerReader.NamespaceURI);
     writer.WriteAttributes(headerReader, false);
     headerReader.Close();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:ReadableMessageHeader.cs

示例3: OnWriteStartBody

        protected override void OnWriteStartBody(XmlDictionaryWriter writer)
        {
            if (this.state == BodyState.Created)
            {
                this.InnerMessage.WriteStartBody(writer);
                return;
            }

            XmlDictionaryReader reader = CreateFullBodyReader();
            reader.MoveToContent();
            writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
            writer.WriteAttributes(reader, false);
            reader.Close();
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:14,代码来源:SecurityVerifiedMessage.cs

示例4: OnWriteBodyContents

            protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
            {
                XmlDictionaryReader reader = this.originalMessage.GetReaderAtBodyContents();

                // Write root StartElement
                writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
                writer.WriteAttributes(reader, true);
                reader.ReadStartElement();

                // Write QueryResult StartElement
                writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
                writer.WriteAttributes(reader, true);

                // Write QueryResult content
                string nodeName = reader.LocalName;
                reader.Read();

                while (reader.NodeType != XmlNodeType.EndElement || reader.Name != nodeName)
                {
                    XmlReader subtree = reader.ReadSubtree();
                    writer.WriteNode(subtree, false);
                    reader.ReadEndElement();
                }

                // Insert metadata start
                writer.WriteStartElement("Metadata");
                writer.WriteAttributeString("type", "array");
                // This two foreach loops are to ensure we write the return entity of the query first, then all the rest.
                // This is a requirement of the RIA/JS client side implementation. If modifying this, client side needs update too.
                foreach (ServiceMetadataGenerator.TypeMetadata map in ServiceMetadataGenerator.EntitiesMetadata)
                {
                    if (map.Name == this.entityTypeName)
                    {
                        writer.WriteStartElement("item");
                        writer.WriteAttributeString("type", "object");
                        map.WriteJson(writer);
                        writer.WriteEndElement();
                        break;
                    }
                }
                foreach (ServiceMetadataGenerator.TypeMetadata map in ServiceMetadataGenerator.EntitiesMetadata)
                {
                    if (map.Name != this.entityTypeName)
                    {
                        writer.WriteStartElement("item");
                        writer.WriteAttributeString("type", "object");
                        map.WriteJson(writer);
                        writer.WriteEndElement();
                    }
                }
                writer.WriteEndElement();
                // Insert metadata end

                // Close QueryResult
                writer.WriteEndElement();
                // Close root
                writer.WriteEndElement();
            }
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:58,代码来源:ServiceMetadataEndpointBehavior.cs

示例5: OnWriteStartHeader

 protected override void OnWriteStartHeader(XmlDictionaryWriter writer, MessageVersion messageVersion)
 {
     if (!IsMessageVersionSupported(messageVersion))
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.Format(SR.MessageHeaderVersionNotSupported, this.GetType().FullName, messageVersion.ToString()), "version"));
     XmlDictionaryReader reader = GetHeaderReader();
     writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
     writer.WriteAttributes(reader, false);
     reader.Dispose();
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:9,代码来源:MessageHeader.cs

示例6: WriteObjectContent

 public override void WriteObjectContent(XmlDictionaryWriter writer, object graph)
 {
     if (writer == null) throw new ArgumentNullException("writer");
     if (writer.WriteState != WriteState.Element)
         throw new SerializationException(string.Format("WriteState '{0}' not valid. Caller must write start element before serializing in contentOnly mode.",
             writer.WriteState));
     using (MemoryStream memoryStream = new MemoryStream())
     {
         using (XmlDictionaryWriter bufferWriter = XmlDictionaryWriter.CreateTextWriter(memoryStream, Encoding.UTF8))
         {
             serializer.Serialize(bufferWriter, graph);
             bufferWriter.Flush();
             memoryStream.Position = 0;
             using (XmlReader reader = new XmlTextReader(memoryStream))
             {
                 reader.MoveToContent();
                 writer.WriteAttributes(reader, false);
                 if (reader.Read()) // move off start node (we want to skip it)
                 {
                     while (reader.NodeType != XmlNodeType.EndElement) // also skip end node.
                         writer.WriteNode(reader, false); // this will take us to the start of the next child node, or the end node.
                     reader.ReadEndElement(); // not necessary, but clean
                 }
             }
         }
     }
 }
开发者ID:NSWPlanning,项目名称:edais,代码行数:27,代码来源:SecurityHeaderFactory.cs

示例7: OnWriteStartBody

        protected override void OnWriteStartBody(XmlDictionaryWriter writer)
        {
            if (this.startBodyFragment != null || this.fullBodyFragment != null)
            {
                WriteStartInnerMessageWithId(writer);
                return;
            }

            switch (this.state)
            {
                case BodyState.Created:
                case BodyState.Encrypted:
                    this.InnerMessage.WriteStartBody(writer);
                    return;
                case BodyState.Signed:
                case BodyState.EncryptedThenSigned:
                    XmlDictionaryReader reader = fullBodyBuffer.GetReader(0);
                    writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
                    writer.WriteAttributes(reader, false);
                    reader.Close();
                    return;
                case BodyState.SignedThenEncrypted:
                    writer.WriteStartElement(this.bodyPrefix, XD.MessageDictionary.Body, this.Version.Envelope.DictionaryNamespace);
                    if (this.bodyAttributes != null)
                    {
                        XmlAttributeHolder.WriteAttributes(this.bodyAttributes, writer);
                    }
                    return;
                default:
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateBadStateException("OnWriteStartBody"));
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:32,代码来源:SecurityAppliedMessage.cs

示例8: OnWriteStartHeaders

 protected override void OnWriteStartHeaders(XmlDictionaryWriter writer)
 {
     using (XmlDictionaryReader reader = this.GetMessageReader())
     {
         reader.MoveToContent();
         EnvelopeVersion envelope = this.Version.Envelope;
         reader.Read();
         if (ReceivedMessage.HasHeaderElement(reader, envelope))
         {
             writer.WriteStartElement(reader.Prefix, "Header", envelope.Namespace);
             writer.WriteAttributes(reader, false);
         }
         else
         {
             writer.WriteStartElement("s", "Header", envelope.Namespace);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:BufferedMessage.cs

示例9: OnWriteStartEnvelope

 protected override void OnWriteStartEnvelope(XmlDictionaryWriter writer)
 {
     using (XmlDictionaryReader reader = this.GetMessageReader())
     {
         reader.MoveToContent();
         EnvelopeVersion envelope = this.Version.Envelope;
         writer.WriteStartElement(reader.Prefix, "Envelope", envelope.Namespace);
         writer.WriteAttributes(reader, false);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:BufferedMessage.cs

示例10: OnWriteStartBody

 protected override void OnWriteStartBody(XmlDictionaryWriter writer)
 {
     using (XmlDictionaryReader reader = this.GetBufferedReaderAtBody())
     {
         writer.WriteStartElement(reader.Prefix, "Body", this.Version.Envelope.Namespace);
         writer.WriteAttributes(reader, false);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:BufferedMessage.cs

示例11: OnWriteStartBody

        protected override void OnWriteStartBody(XmlDictionaryWriter writer)
        {
            if ((this.startBodyFragment != null) || (this.fullBodyFragment != null))
            {
                this.WriteStartInnerMessageWithId(writer);
            }
            else
            {
                switch (this.state)
                {
                    case BodyState.Created:
                    case BodyState.Encrypted:
                        base.InnerMessage.WriteStartBody(writer);
                        return;

                    case BodyState.Signed:
                    case BodyState.EncryptedThenSigned:
                    {
                        XmlDictionaryReader reader = this.fullBodyBuffer.GetReader(0);
                        writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
                        writer.WriteAttributes(reader, false);
                        reader.Close();
                        return;
                    }
                    case BodyState.SignedThenEncrypted:
                        writer.WriteStartElement(this.bodyPrefix, System.ServiceModel.XD.MessageDictionary.Body, this.Version.Envelope.DictionaryNamespace);
                        if (this.bodyAttributes != null)
                        {
                            System.IdentityModel.XmlAttributeHolder.WriteAttributes(this.bodyAttributes, writer);
                        }
                        return;
                }
                throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(this.CreateBadStateException("OnWriteStartBody"));
            }
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:SecurityAppliedMessage.cs

示例12: OnWriteStartBody

 protected override void OnWriteStartBody(XmlDictionaryWriter writer)
 {
     switch (this.state)
     {
         case BodyState.Created:
             this.InnerMessage.WriteStartBody(writer);
             return;
         case BodyState.Signed:
             using (XmlDictionaryReader reader = Utility.CreateReader(this.fullBodyBuffer))
             {
                 reader.MoveToStartElement();
                 writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
                 writer.WriteAttributes(reader, false);
             }
             return;
         default:
             throw new ArgumentException("Can't write the message because it is in a bad or unknown state");
     }
 }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:19,代码来源:SignedMessage.cs

示例13: OnWriteHeaderAttributes

        /// <summary>
        /// Writes header attributes.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="messageVersion">The message version.</param>
        /// <exception cref="System.ArgumentNullException">
        /// writer
        /// or
        /// messageVersion
        /// </exception>
        /// <exception cref="ArgumentNullException">The <paramref name="writer"/> parameter is null.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="messageVersion"/> parameter is null.</exception>
        protected void OnWriteHeaderAttributes(XmlDictionaryWriter writer, MessageVersion messageVersion)
        {
            if (writer == null)
                throw new ArgumentNullException("writer");

            if (messageVersion == null)
                throw new ArgumentNullException("messageVersion");

            WriteHeaderAttributes(writer, messageVersion);
            using (var xmlNodeReader = new XmlNodeReader(_headerValue))
            {
                using (var reader = XmlDictionaryReader.CreateDictionaryReader(xmlNodeReader))
                {
                    reader.MoveToContent();
                    writer.WriteAttributes(reader, false);
                }
            }
        }
开发者ID:mparsin,项目名称:Elements,代码行数:30,代码来源:XmlElementMessageHeader.cs


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