本文整理汇总了C#中System.Xml.XmlDictionaryReader类的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryReader类的具体用法?C# XmlDictionaryReader怎么用?C# XmlDictionaryReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlDictionaryReader类属于System.Xml命名空间,在下文中一共展示了XmlDictionaryReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ReadObject
/// <summary>
/// Reads the XML stream or document with an <see cref="T:System.Xml.XmlDictionaryReader" /> and returns the deserialized object; it also enables you to specify whether the serializer can read the data before attempting to read it.
/// </summary>
/// <param name="reader">An <see cref="T:System.Xml.XmlDictionaryReader" /> used to read the XML document.</param>
/// <param name="verifyObjectName">true to check whether the enclosing XML element name and namespace correspond to the root name and root namespace; otherwise, false to skip the verification.</param>
/// <returns>
/// The deserialized object.
/// </returns>
public override object ReadObject(XmlDictionaryReader reader, bool verifyObjectName)
{
Argument.IsNotNull("reader", reader);
var memoryStream = new MemoryStream(reader.ReadElementContentAsBase64());
return BinarySerializerHelper.DiscoverAndDeSerialize(memoryStream, _type);
}
开发者ID:JaysonJG,项目名称:Catel,代码行数:15,代码来源:BinarySerializer.cs
示例17: ReadXml
public void ReadXml( XmlDictionaryReader reader )
{
if ( reader == null )
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "reader" );
}
reader.MoveToContent();
if ( !reader.IsStartElement( XmlEncryptionConstants.Elements.CipherData, XmlEncryptionConstants.Namespace ) )
{
throw DiagnosticUtility.ThrowHelperXml( reader, SR.GetString( SR.ID4188 ) );
}
reader.ReadStartElement( XmlEncryptionConstants.Elements.CipherData, XmlEncryptionConstants.Namespace );
reader.ReadStartElement( XmlEncryptionConstants.Elements.CipherValue, XmlEncryptionConstants.Namespace );
_cipherText = reader.ReadContentAsBase64();
_iv = null;
// <CipherValue>
reader.MoveToContent();
reader.ReadEndElement();
// <CipherData>
reader.MoveToContent();
reader.ReadEndElement();
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:28,代码来源:CipherDataElement.cs
示例18: XmlDelegatedReader
public XmlDelegatedReader(XmlDictionaryReader reader)
{
if (reader == null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("reader"));
this.reader = reader;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:XmlDelegatedReader.cs
示例19: DecryptHeader
protected override DecryptedHeader DecryptHeader(XmlDictionaryReader reader, WrappedKeySecurityToken wrappedKeyToken)
{
SecurityToken token;
EncryptedHeaderXml xml = new EncryptedHeaderXml(base.Version) {
SecurityTokenSerializer = base.StandardsManager.SecurityTokenSerializer
};
xml.ReadFrom(reader, base.MaxReceivedMessageSize);
if (xml.MustUnderstand != this.MustUnderstand)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(System.ServiceModel.SR.GetString("EncryptedHeaderAttributeMismatch", new object[] { XD.MessageDictionary.MustUnderstand.Value, xml.MustUnderstand, this.MustUnderstand })));
}
if (xml.Relay != this.Relay)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(System.ServiceModel.SR.GetString("EncryptedHeaderAttributeMismatch", new object[] { XD.Message12Dictionary.Relay.Value, xml.Relay, this.Relay })));
}
if (xml.Actor != this.Actor)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(System.ServiceModel.SR.GetString("EncryptedHeaderAttributeMismatch", new object[] { base.Version.Envelope.DictionaryActor, xml.Actor, this.Actor })));
}
if (wrappedKeyToken == null)
{
token = WSSecurityOneDotZeroReceiveSecurityHeader.ResolveKeyIdentifier(xml.KeyIdentifier, base.CombinedPrimaryTokenResolver, false);
}
else
{
token = wrappedKeyToken;
}
base.RecordEncryptionToken(token);
using (SymmetricAlgorithm algorithm = WSSecurityOneDotZeroReceiveSecurityHeader.CreateDecryptionAlgorithm(token, xml.EncryptionMethod, base.AlgorithmSuite))
{
xml.SetUpDecryption(algorithm);
return new DecryptedHeader(xml.GetDecryptedBuffer(), base.SecurityVerifiedMessage.GetEnvelopeAttributes(), base.SecurityVerifiedMessage.GetHeaderAttributes(), base.Version, base.StandardsManager.IdManager, base.ReaderQuotas);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:WSSecurityOneDotOneReceiveSecurityHeader.cs
示例20: ReadNode
private Expression<Func<ClaimsPrincipal, bool>> ReadNode(XmlDictionaryReader rdr, ParameterExpression subject)
{
Expression<Func<ClaimsPrincipal, bool>> policyExpression;
if (!rdr.IsStartElement())
{
throw new InvalidOperationException("Invalid Policy format.");
}
switch (rdr.Name)
{
case "and":
policyExpression = ReadAnd(rdr, subject);
break;
case "or":
policyExpression = ReadOr(rdr, subject);
break;
case "claim":
policyExpression = ReadClaim(rdr);
break;
default:
policyExpression = DefaultPolicy;
break;
}
return policyExpression;
}
开发者ID:etopcu,项目名称:Dashboard,代码行数:27,代码来源:PolicyReader.cs
注:本文中的System.Xml.XmlDictionaryReader类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论