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


C# Xml.XmlDictionaryReader类代码示例

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


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

示例1: ReadXml

        public virtual void ReadXml(XmlDictionaryReader reader, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer, SecurityTokenResolver outOfBandTokenResolver)
        {
            if (reader == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("reader"));

            if (samlSerializer == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSerializer"));

#pragma warning suppress 56506 // samlSerializer.DictionaryManager is never null.
            SamlDictionary dictionary = samlSerializer.DictionaryManager.SamlDictionary;

            if (reader.IsStartElement(dictionary.Action, dictionary.Namespace))
            {
                // The Namespace attribute is optional.
                this.ns = reader.GetAttribute(dictionary.ActionNamespaceAttribute, null);

                reader.MoveToContent();
                this.action = reader.ReadString();
                if (string.IsNullOrEmpty(this.action))
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(SR.GetString(SR.SAMLActionNameRequiredOnRead)));

                reader.MoveToContent();
                reader.ReadEndElement();
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:25,代码来源:SamlAction.cs

示例2: AssertNode

		void AssertNode (int depth, string localName, XmlNodeType nodeType, string value, string type, XmlDictionaryReader reader, string label)
		{
			Assert.AreEqual (localName, reader.LocalName, label + ".LocalName");
			Assert.AreEqual (nodeType, reader.NodeType, label + ".NodeType");
			Assert.AreEqual (value, reader.Value, label + ".Value");
			Assert.AreEqual (type, reader.GetAttribute ("type"), label + ".GetAttribute('type')");
		}
开发者ID:blinds52,项目名称:mono,代码行数:7,代码来源:JsonReaderTest.cs

示例3: ReadXml

        public void ReadXml( XmlDictionaryReader reader )
        {
            if ( reader == null )
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "reader" );
            }

            reader.MoveToContent();
            if ( !reader.IsStartElement( XmlEncryptionConstants.Elements.EncryptionMethod, XmlEncryptionConstants.Namespace ) )
            {
                return;
            }

            _algorithm = reader.GetAttribute( XmlEncryptionConstants.Attributes.Algorithm, null );

            if ( !reader.IsEmptyElement )
            {
                //
                // Trace unread missing element
                //

                string xml = reader.ReadOuterXml();
                if ( DiagnosticUtility.ShouldTraceWarning )
                {
                    TraceUtility.TraceString( System.Diagnostics.TraceEventType.Warning, SR.GetString( SR.ID8024, reader.Name, reader.NamespaceURI, xml ) );
                }
            }
            else
            {
                //
                // Read to the next element
                //
                reader.Read();
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:35,代码来源:EncryptionMethodElement.cs

示例4: ReadPolicy

        /// <summary> 
        /// Read the policy as a LINQ expression 
        /// </summary> 
        /// <param name="rdr">XmlDictionaryReader for the policy Xml</param> 
        /// <returns></returns> 
        public Expression<Func<ClaimsPrincipal, bool>> ReadPolicy(XmlDictionaryReader rdr)
        {
            if (rdr.Name != "policy")
            {
                throw new InvalidOperationException("Invalid policy document");
            }

            rdr.Read();

            if (!rdr.IsStartElement())
            {
                rdr.ReadEndElement();
                // There are no claims inside this policy which means allow access to the page. 
                return AllowAccessForDefaultPagePolicy;
            }
            // 
            // Instantiate a parameter for the ClaimsPrincipal so it can be evaluated against 
            // each claim constraint. 
            //  
            ParameterExpression subject = Expression.Parameter(typeof(ClaimsPrincipal), "subject");
            Expression<Func<ClaimsPrincipal, bool>> result = ReadNode(rdr, subject);

            rdr.ReadEndElement();

            return result;
        }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:31,代码来源:PolicyReader.cs

示例5: CreateWsrmHeaderFault

 private static WsrmHeaderFault CreateWsrmHeaderFault(ReliableMessagingVersion reliableMessagingVersion, FaultCode code, string subcode, FaultReason reason, XmlDictionaryReader detailReader)
 {
     if (code.IsSenderFault)
     {
         if (subcode == "InvalidAcknowledgement")
         {
             return new InvalidAcknowledgementFault(code, reason, detailReader, reliableMessagingVersion);
         }
         if (subcode == "MessageNumberRollover")
         {
             return new MessageNumberRolloverFault(code, reason, detailReader, reliableMessagingVersion);
         }
         if (subcode == "UnknownSequence")
         {
             return new UnknownSequenceFault(code, reason, detailReader, reliableMessagingVersion);
         }
         if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005)
         {
             if (subcode == "LastMessageNumberExceeded")
             {
                 return new LastMessageNumberExceededFault(code, reason, detailReader, reliableMessagingVersion);
             }
         }
         else if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && (subcode == "SequenceClosed"))
         {
             return new SequenceClosedFault(code, reason, detailReader, reliableMessagingVersion);
         }
     }
     if (!code.IsSenderFault && !code.IsReceiverFault)
     {
         return null;
     }
     return new SequenceTerminatedFault(code, reason, detailReader, reliableMessagingVersion);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:WsrmHeaderFault.cs

示例6: XmlRpcMessage

 public XmlRpcMessage(XmlDictionaryReader paramsSection)
     : this()
 {
     bodyReader = paramsSection;
     bodyReader.MoveToContent();
     isFault = false;
 }
开发者ID:ehabqadah,项目名称:Distributed-Nodes-Network-Management,代码行数:7,代码来源:XmlRpcMessage.cs

示例7: ReadXml

 public override void ReadXml(XmlDictionaryReader reader, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer, SecurityTokenResolver outOfBandTokenResolver)
 {
     if (reader == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("reader"));
     }
     if (samlSerializer == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSerializer"));
     }
     SamlDictionary samlDictionary = samlSerializer.DictionaryManager.SamlDictionary;
     if (!reader.IsStartElement(samlDictionary.DoNotCacheCondition, samlDictionary.Namespace))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(System.IdentityModel.SR.GetString("SAMLBadSchema", new object[] { samlDictionary.DoNotCacheCondition.Value })));
     }
     if (reader.IsEmptyElement)
     {
         reader.MoveToContent();
         reader.Read();
     }
     else
     {
         reader.MoveToContent();
         reader.Read();
         reader.ReadEndElement();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:SamlDoNotCacheCondition.cs

示例8: ReadObject

 public override object ReadObject(XmlDictionaryReader reader, bool verifyObjectName)
 {
     reader.ReadStartElement("Data");
     var data = reader.ReadContentAsBase64();
     reader.ReadEndElement();
     return DecodeObject(data);
 }
开发者ID:cg123,项目名称:xenko,代码行数:7,代码来源:XenkoXmlObjectSerializer.cs

示例9: ReadAttributes

 public static XmlAttributeHolder[] ReadAttributes(XmlDictionaryReader reader, ref int maxSizeOfHeaders)
 {
     if (reader.AttributeCount == 0)
         return emptyArray;
     XmlAttributeHolder[] attributes = new XmlAttributeHolder[reader.AttributeCount];
     reader.MoveToFirstAttribute();
     for (int i = 0; i < attributes.Length; i++)
     {
         string ns = reader.NamespaceURI;
         string localName = reader.LocalName;
         string prefix = reader.Prefix;
         string value = string.Empty;
         while (reader.ReadAttributeValue())
         {
             if (value.Length == 0)
                 value = reader.Value;
             else
                 value += reader.Value;
         }
         Deduct(prefix, ref maxSizeOfHeaders);
         Deduct(localName, ref maxSizeOfHeaders);
         Deduct(ns, ref maxSizeOfHeaders);
         Deduct(value, ref maxSizeOfHeaders);
         attributes[i] = new XmlAttributeHolder(prefix, localName, ns, value);
         reader.MoveToNextAttribute();
     }
     reader.MoveToElement();
     return attributes;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:29,代码来源:XmlAttributeHolder.cs

示例10: UriRewriterBodyWriter

 public UriRewriterBodyWriter(string sourcePattern, string targetPattern, XmlDictionaryReader reader)
     : base(false)
 {
     this.sourcePattern = sourcePattern;
     this.targetPattern = targetPattern;
     this.reader = reader;
 }
开发者ID:managedfusion,项目名称:managedfusion-rewriter-proxy,代码行数:7,代码来源:UriRewriterBodyWriter.cs

示例11: BinaryBodyReader

 public BinaryBodyReader(XmlDictionaryReader reader)
 {
     reader.ReadStartElement(BinaryElementName);
     _data = reader.ReadContentAsBase64();
     if (reader.NodeType == XmlNodeType.Text) reader.Read();
     reader.ReadEndElement();
 }
开发者ID:huoxudong125,项目名称:WcfRestContrib,代码行数:7,代码来源:BinaryBodyReader.cs

示例12: X509CertificateEndpointIdentity

        internal X509CertificateEndpointIdentity(XmlDictionaryReader reader)
        {
            if (reader == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader");

            reader.MoveToContent();
            if (reader.IsEmptyElement)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.Format(SR.UnexpectedEmptyElementExpectingClaim, XD.AddressingDictionary.X509v3Certificate.Value, XD.AddressingDictionary.IdentityExtensionNamespace.Value)));

            reader.ReadStartElement(XD.XmlSignatureDictionary.X509Data, XD.XmlSignatureDictionary.Namespace);
            while (reader.IsStartElement(XD.XmlSignatureDictionary.X509Certificate, XD.XmlSignatureDictionary.Namespace))
            {
                reader.MoveToContent();
                X509Certificate2 certificate = new X509Certificate2(Convert.FromBase64String(reader.ReadContentAsString()));
                if (certificateCollection.Count == 0)
                {
                    // This is the first certificate. We assume this as the primary 
                    // certificate and initialize the base class.
                    Initialize(new Claim(ClaimTypes.Thumbprint, certificate.GetCertHash(), Rights.PossessProperty));
                }

                certificateCollection.Add(certificate);
            }

            reader.ReadEndElement();

            if (certificateCollection.Count == 0)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.Format(SR.UnexpectedEmptyElementExpectingClaim, XD.AddressingDictionary.X509v3Certificate.Value, XD.AddressingDictionary.IdentityExtensionNamespace.Value)));
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:29,代码来源:X509CertificateEndpointIdentity.cs

示例13: SecurityVerifiedMessage

 public SecurityVerifiedMessage(Message messageToProcess, ReceiveSecurityHeader securityHeader)
     : base(messageToProcess)
 {
     this.securityHeader = securityHeader;
     if (securityHeader.RequireMessageProtection)
     {
         XmlDictionaryReader messageReader;
         BufferedMessage bufferedMessage = this.InnerMessage as BufferedMessage;
         if (bufferedMessage != null && this.Headers.ContainsOnlyBufferedMessageHeaders)
         {
             messageReader = bufferedMessage.GetMessageReader();
         }
         else
         {
             this.messageBuffer = new XmlBuffer(int.MaxValue);
             XmlDictionaryWriter writer = this.messageBuffer.OpenSection(this.securityHeader.ReaderQuotas);
             this.InnerMessage.WriteMessage(writer);
             this.messageBuffer.CloseSection();
             this.messageBuffer.Close();
             messageReader = this.messageBuffer.GetReader(0);
         }
         MoveToSecurityHeader(messageReader, securityHeader.HeaderIndex, true);
         this.cachedReaderAtSecurityHeader = messageReader;
         this.state = BodyState.Buffered;
     }
     else
     {
         this.envelopeAttributes = XmlAttributeHolder.emptyArray;
         this.headerAttributes = XmlAttributeHolder.emptyArray;
         this.bodyAttributes = XmlAttributeHolder.emptyArray;
         this.canDelegateCreateBufferedCopyToInnerMessage = true;
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:33,代码来源:SecurityVerifiedMessage.cs

示例14: CreateMessageCopy

 private Message CreateMessageCopy(Message message, XmlDictionaryReader body)
 {
     Message copy = Message.CreateMessage(message.Version,message.Headers.Action,body);
     copy.Headers.CopyHeaderFrom(message,0);
     copy.Properties.CopyProperties(message.Properties);
     return copy;
 }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:7,代码来源:DispatchByBodyElementOperationSelector.cs

示例15: ReadXml

        public override void ReadXml(XmlDictionaryReader reader, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer, SecurityTokenResolver outOfBandTokenResolver)
        {
            if (reader == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("reader"));

            if (samlSerializer == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSerializer"));

#pragma warning suppress 56506 // samlSerializer.DictionaryManager is never null.
            SamlDictionary dictionary = samlSerializer.DictionaryManager.SamlDictionary;

            if (!reader.IsStartElement(dictionary.DoNotCacheCondition, dictionary.Namespace))
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(SR.GetString(SR.SAMLBadSchema, dictionary.DoNotCacheCondition.Value)));

            // saml:DoNotCacheCondition is a empty element. So just issue a read for
            // the empty element.
            if (reader.IsEmptyElement)
            {
                reader.MoveToContent();
                reader.Read();
                return;
            }

            reader.MoveToContent();
            reader.Read();
            reader.ReadEndElement();
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:27,代码来源:SamlDoNotCacheCondition.cs


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