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


C# XmlDictionaryReader.IsNamespaceUri方法代码示例

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


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

示例1: ReadFrom

 internal static EndpointAddress ReadFrom(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString ns, out AddressingVersion version)
 {
     if (reader == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader");
     }
     reader.ReadFullStartElement(localName, ns);
     reader.MoveToContent();
     if (reader.IsNamespaceUri(AddressingVersion.WSAddressing10.DictionaryNamespace))
     {
         version = AddressingVersion.WSAddressing10;
     }
     else if (reader.IsNamespaceUri(AddressingVersion.WSAddressingAugust2004.DictionaryNamespace))
     {
         version = AddressingVersion.WSAddressingAugust2004;
     }
     else
     {
         if (reader.NodeType != XmlNodeType.Element)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("reader", System.ServiceModel.SR.GetString("CannotDetectAddressingVersion"));
         }
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("reader", System.ServiceModel.SR.GetString("AddressingVersionNotSupported", new object[] { reader.NamespaceURI }));
     }
     EndpointAddress address = ReadFromDriver(version, reader);
     reader.ReadEndElement();
     return address;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:EndpointAddress.cs

示例2: ReadContentsFrom200408

 private static bool ReadContentsFrom200408(XmlDictionaryReader reader, out System.Uri uri, out AddressHeaderCollection headers, out EndpointIdentity identity, out XmlBuffer buffer, out int metadataSection, out int extensionSection, out int pspSection)
 {
     buffer = null;
     headers = null;
     extensionSection = -1;
     metadataSection = -1;
     pspSection = -1;
     reader.MoveToContent();
     if (!reader.IsStartElement(XD.AddressingDictionary.Address, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateXmlException(reader, System.ServiceModel.SR.GetString("UnexpectedElementExpectingElement", new object[] { reader.LocalName, reader.NamespaceURI, XD.AddressingDictionary.Address.Value, XD.Addressing200408Dictionary.Namespace.Value })));
     }
     string uriString = reader.ReadElementContentAsString();
     reader.MoveToContent();
     if (reader.IsStartElement(XD.AddressingDictionary.ReferenceProperties, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace))
     {
         headers = AddressHeaderCollection.ReadServiceParameters(reader, true);
     }
     reader.MoveToContent();
     if (reader.IsStartElement(XD.AddressingDictionary.ReferenceParameters, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace))
     {
         if (headers != null)
         {
             List<AddressHeader> addressHeaders = new List<AddressHeader>();
             foreach (AddressHeader header in headers)
             {
                 addressHeaders.Add(header);
             }
             foreach (AddressHeader header2 in AddressHeaderCollection.ReadServiceParameters(reader))
             {
                 addressHeaders.Add(header2);
             }
             headers = new AddressHeaderCollection(addressHeaders);
         }
         else
         {
             headers = AddressHeaderCollection.ReadServiceParameters(reader);
         }
     }
     XmlDictionaryWriter writer = null;
     reader.MoveToContent();
     if (reader.IsStartElement(XD.AddressingDictionary.PortType, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace))
     {
         if (writer == null)
         {
             if (buffer == null)
             {
                 buffer = new XmlBuffer(0x7fff);
             }
             writer = buffer.OpenSection(reader.Quotas);
             writer.WriteStartElement("Dummy", "http://Dummy");
         }
         writer.WriteNode(reader, true);
     }
     reader.MoveToContent();
     if (reader.IsStartElement(XD.AddressingDictionary.ServiceName, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace))
     {
         if (writer == null)
         {
             if (buffer == null)
             {
                 buffer = new XmlBuffer(0x7fff);
             }
             writer = buffer.OpenSection(reader.Quotas);
             writer.WriteStartElement("Dummy", "http://Dummy");
         }
         writer.WriteNode(reader, true);
     }
     reader.MoveToContent();
     while (reader.IsNamespaceUri(XD.PolicyDictionary.Namespace))
     {
         if (writer == null)
         {
             if (buffer == null)
             {
                 buffer = new XmlBuffer(0x7fff);
             }
             writer = buffer.OpenSection(reader.Quotas);
             writer.WriteStartElement("Dummy", "http://Dummy");
         }
         writer.WriteNode(reader, true);
         reader.MoveToContent();
     }
     if (writer != null)
     {
         writer.WriteEndElement();
         buffer.CloseSection();
         pspSection = buffer.SectionCount - 1;
         writer = null;
     }
     else
     {
         pspSection = -1;
     }
     if (reader.IsStartElement("Metadata", "http://schemas.xmlsoap.org/ws/2004/09/mex"))
     {
         if (writer == null)
         {
             if (buffer == null)
             {
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:EndpointAddress.cs

示例3: ReadFrom

        internal static EndpointAddress ReadFrom(XmlDictionaryReader reader, out AddressingVersion version)
        {
            if (reader == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader");

            reader.ReadFullStartElement();
            reader.MoveToContent();

            if (reader.IsNamespaceUri(AddressingVersion.WSAddressing10.DictionaryNamespace))
            {
                version = AddressingVersion.WSAddressing10;
            }
            else if (reader.IsNamespaceUri(AddressingVersion.WSAddressingAugust2004.DictionaryNamespace))
            {
                version = AddressingVersion.WSAddressingAugust2004;
            }
            else if (reader.NodeType != XmlNodeType.Element)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(
                    "reader", SR.GetString(SR.CannotDetectAddressingVersion));
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(
                    "reader", SR.GetString(SR.AddressingVersionNotSupported, reader.NamespaceURI));
            }

            EndpointAddress ea = ReadFromDriver(version, reader);
            reader.ReadEndElement();
            return ea;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:31,代码来源:EndpointAddress.cs

示例4: ReadContentsFrom200408

        static bool ReadContentsFrom200408(XmlDictionaryReader reader, out Uri uri, out AddressHeaderCollection headers, out EndpointIdentity identity, out XmlBuffer buffer, out int metadataSection, out int extensionSection, out int pspSection)
        {
            buffer = null;
            headers = null;
            extensionSection = -1;
            metadataSection = -1;
            pspSection = -1;

            // Cache address string
            reader.MoveToContent();
            if (!reader.IsStartElement(XD.AddressingDictionary.Address, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateXmlException(reader, SR.GetString(SR.UnexpectedElementExpectingElement, reader.LocalName, reader.NamespaceURI, XD.AddressingDictionary.Address.Value, XD.Addressing200408Dictionary.Namespace.Value)));
            }
            string address = reader.ReadElementContentAsString();

            // ReferenceProperites
            reader.MoveToContent();
            if (reader.IsStartElement(XD.AddressingDictionary.ReferenceProperties, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace))
            {
                headers = AddressHeaderCollection.ReadServiceParameters(reader, true);
            }

            // ReferenceParameters
            reader.MoveToContent();
            if (reader.IsStartElement(XD.AddressingDictionary.ReferenceParameters, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace))
            {
                if (headers != null)
                {
                    List<AddressHeader> headerList = new List<AddressHeader>();
                    foreach (AddressHeader ah in headers)
                    {
                        headerList.Add(ah);
                    }
                    AddressHeaderCollection tmp = AddressHeaderCollection.ReadServiceParameters(reader);
                    foreach (AddressHeader ah in tmp)
                    {
                        headerList.Add(ah);
                    }
                    headers = new AddressHeaderCollection(headerList);
                }
                else
                {
                    headers = AddressHeaderCollection.ReadServiceParameters(reader);
                }
            }

            XmlDictionaryWriter bufferWriter = null;

            // PortType
            reader.MoveToContent();
            if (reader.IsStartElement(XD.AddressingDictionary.PortType, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace))
            {
                if (bufferWriter == null)
                {
                    if (buffer == null)
                        buffer = new XmlBuffer(short.MaxValue);
                    bufferWriter = buffer.OpenSection(reader.Quotas);
                    bufferWriter.WriteStartElement(DummyName, DummyNamespace);
                }
                bufferWriter.WriteNode(reader, true);
            }

            // ServiceName
            reader.MoveToContent();
            if (reader.IsStartElement(XD.AddressingDictionary.ServiceName, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace))
            {
                if (bufferWriter == null)
                {
                    if (buffer == null)
                        buffer = new XmlBuffer(short.MaxValue);
                    bufferWriter = buffer.OpenSection(reader.Quotas);
                    bufferWriter.WriteStartElement(DummyName, DummyNamespace);
                }
                bufferWriter.WriteNode(reader, true);
            }

            // Policy
            reader.MoveToContent();
            while (reader.IsNamespaceUri(XD.PolicyDictionary.Namespace))
            {
                if (bufferWriter == null)
                {
                    if (buffer == null)
                        buffer = new XmlBuffer(short.MaxValue);
                    bufferWriter = buffer.OpenSection(reader.Quotas);
                    bufferWriter.WriteStartElement(DummyName, DummyNamespace);
                }
                bufferWriter.WriteNode(reader, true);
                reader.MoveToContent();
            }

            // Finish PSP
            if (bufferWriter != null)
            {
                bufferWriter.WriteEndElement();
                buffer.CloseSection();
                pspSection = buffer.SectionCount - 1;
                bufferWriter = null;
            }
//.........这里部分代码省略.........
开发者ID:uQr,项目名称:referencesource,代码行数:101,代码来源:EndpointAddress.cs

示例5: ReadFrom

        /// <summary>
        /// Reads an <see cref="EndpointReference"/> from xml dictionary reader. The addressing version is defaulted to
        /// <see cref="WSAddressing10Constants.Elements.Address"/>.
        /// </summary>
        /// <param name="reader">The xml dictionary reader.</param>
        /// <returns>An <see cref="EndpointReference"/> instance.</returns>
        public static EndpointReference ReadFrom(XmlDictionaryReader reader)
        {
            if (reader == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader");
            }

            reader.ReadFullStartElement();
            reader.MoveToContent();

            if (reader.IsNamespaceUri(WSAddressing10Constants.NamespaceUri) || reader.IsNamespaceUri(WSAddressing200408Constants.NamespaceUri))
            {
                if (reader.IsStartElement(WSAddressing10Constants.Elements.Address, WSAddressing10Constants.NamespaceUri) ||
                    reader.IsStartElement(WSAddressing10Constants.Elements.Address, WSAddressing200408Constants.NamespaceUri))
                {
                    EndpointReference er = new EndpointReference(reader.ReadElementContentAsString());
                    while ( reader.IsStartElement() )
                    {
                        bool emptyElement = reader.IsEmptyElement;
                        
                        XmlReader subtreeReader = reader.ReadSubtree();
                        XmlDocument doc = new XmlDocument();
                        doc.PreserveWhitespace = true;
                        doc.Load( subtreeReader );
                        er._details.Add( doc.DocumentElement );
                        if ( !emptyElement )
                        {
                            reader.ReadEndElement();
                        }
                    }

                    reader.ReadEndElement();
                    return er;
                }
            }

            return null;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:44,代码来源:EndpointReference.cs


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