本文整理汇总了C#中System.Xml.XmlDictionaryReader.MoveToContent方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryReader.MoveToContent方法的具体用法?C# XmlDictionaryReader.MoveToContent怎么用?C# XmlDictionaryReader.MoveToContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryReader
的用法示例。
在下文中一共展示了XmlDictionaryReader.MoveToContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
}
示例2: 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();
}
示例3: 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)));
}
示例4: 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();
}
示例5: DeserializeStruct
private static object DeserializeStruct(XmlDictionaryReader reader, Type targetType)
{
if (targetType.IsDefined(typeof(DataContractAttribute), false))
{
Dictionary<string, MemberInfo> dataMembers = GetDataMembers(targetType);
object targetObject = Activator.CreateInstance(targetType);
reader.ReadStartElement(XmlRpcProtocol.Struct);
while( reader.NodeType != XmlNodeType.EndElement )
{
string memberName;
reader.ReadStartElement(XmlRpcProtocol.Member);
reader.ReadStartElement(XmlRpcProtocol.Name);
memberName = reader.ReadContentAsString();
reader.ReadEndElement();
reader.ReadStartElement(XmlRpcProtocol.Value);
reader.MoveToContent();
if (dataMembers.ContainsKey(memberName))
{
MemberInfo member = dataMembers[memberName];
if (member is PropertyInfo)
{
((PropertyInfo)member).SetValue(
targetObject,
Deserialize(reader, ((PropertyInfo)member).PropertyType),
BindingFlags.Instance | BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.NonPublic,
null, null,
CultureInfo.CurrentCulture);
}
else if (member is FieldInfo)
{
((FieldInfo)member).SetValue(
targetObject,
Deserialize(reader, ((FieldInfo)member).FieldType),
BindingFlags.Instance|BindingFlags.SetField|BindingFlags.Public|BindingFlags.NonPublic,
null,
CultureInfo.CurrentCulture);
}
}
reader.ReadEndElement(); // value
reader.ReadEndElement(); // member
}
reader.ReadEndElement(); // struct
reader.MoveToContent();
return targetObject;
}
else
{
throw new InvalidOperationException();
}
}
开发者ID:ehabqadah,项目名称:Distributed-Nodes-Network-Management,代码行数:55,代码来源:XmlRpcDataContractSerializer.cs
示例6: XmlRpcMessage
public XmlRpcMessage(MessageFault fault)
: this()
{
isFault = true;
bodyReader = XmlRpcDataContractSerializationHelper.CreateFaultReader(fault);
bodyReader.MoveToContent();
}
示例7: 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();
}
}
示例8: ReadXml
public virtual void ReadXml( XmlDictionaryReader reader )
{
if ( reader == null )
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "reader" );
}
reader.MoveToContent();
if ( reader.IsStartElement( XD.XmlSignatureDictionary.KeyInfo.Value, XD.XmlSignatureDictionary.Namespace.Value ) )
{
// <KeyInfo>
reader.ReadStartElement();
while ( reader.IsStartElement() )
{
// <RetrievalMethod>
if ( reader.IsStartElement( XmlSignatureConstants.Elements.RetrievalMethod, XD.XmlSignatureDictionary.Namespace.Value ) )
{
string method = reader.GetAttribute( XD.XmlSignatureDictionary.URI.Value );
if ( !string.IsNullOrEmpty( method ) )
{
_retrieval = method;
}
reader.Skip();
}
// check if internal serializer can handle clause
else if ( _keyInfoSerializer.CanReadKeyIdentifierClause( reader ) )
{
_ski.Add( _keyInfoSerializer.ReadKeyIdentifierClause( reader ) );
}
// trace we skipped over an element
else if ( reader.IsStartElement() )
{
string xml = reader.ReadOuterXml();
if ( DiagnosticUtility.ShouldTraceWarning )
{
TraceUtility.TraceString( System.Diagnostics.TraceEventType.Warning, SR.GetString( SR.ID8023, reader.Name, reader.NamespaceURI, xml ) );
}
}
reader.MoveToContent();
}
reader.MoveToContent();
reader.ReadEndElement();
}
}
示例9: XmlReaderBodyWriter
public XmlReaderBodyWriter (XmlDictionaryReader reader)
: base (false)
{
reader.MoveToContent ();
if (reader.NodeType != XmlNodeType.Element)
throw new InvalidOperationException ("Argument XmlReader is expected to be positioned at element");
this.reader = reader;
}
示例10: ReadFrom
public override void ReadFrom(XmlDictionaryReader reader, DictionaryManager dictionaryManager)
{
reader.MoveToContent();
if (XmlHelper.ReadEmptyElementAndRequiredAttribute(reader, dictionaryManager.XmlSignatureDictionary.Transform, dictionaryManager.XmlSignatureDictionary.Namespace, dictionaryManager.XmlSignatureDictionary.Algorithm, out this.prefix) != this.Algorithm)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CryptographicException(System.IdentityModel.SR.GetString("AlgorithmMismatchForTransform")));
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:EnvelopedSignatureTransform.cs
示例11: XmlReaderBodyWriter
public XmlReaderBodyWriter(XmlDictionaryReader reader, EnvelopeVersion version) : base(false)
{
this.reader = reader;
if (reader.MoveToContent() != XmlNodeType.Element)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("InvalidReaderPositionOnCreateMessage"), "reader"));
}
this.isFault = Message.IsFaultStartElement(reader, version);
}
示例12: ReadHeaderValue
static PollingDuplexSession ReadHeaderValue(XmlDictionaryReader reader)
{
string str = null;
string str2 = null;
if (reader.IsStartElement("Duplex", "http://schemas.microsoft.com/2008/04/netduplex"))
{
reader.ReadStartElement();
reader.MoveToContent();
while (reader.IsStartElement())
{
if (reader.IsStartElement("SessionId", "http://schemas.microsoft.com/2008/04/netduplex"))
{
if (!string.IsNullOrEmpty(str2))
{
throw new InvalidOperationException("Multiple sessionId elements in a duplex header.");
}
str2 = reader.ReadElementContentAsString();
if (string.IsNullOrEmpty(str2))
{
throw new InvalidOperationException("Invalid sessionId element content in a duplex header.");
}
}
else
{
if (reader.IsStartElement("Address", "http://schemas.microsoft.com/2008/04/netduplex"))
{
if (!string.IsNullOrEmpty(str))
{
throw new InvalidOperationException("Multiple address elements in a duplex header.");
}
str = reader.ReadElementContentAsString();
if (string.IsNullOrEmpty(str))
{
throw new InvalidOperationException("Invalid address element in a duplex header.");
}
continue;
}
if (reader.IsStartElement("CloseSession", "http://schemas.microsoft.com/2008/04/netduplex"))
{
reader.Skip();
continue;
}
reader.Skip();
}
}
reader.ReadEndElement();
}
if (str == null)
{
throw new InvalidOperationException("Missing address in a duplex header.");
}
if (str2 == null)
{
throw new InvalidOperationException("Missing sessionId in a duplex header.");
}
return new PollingDuplexSession(str, str2);
}
示例13: ReadFrom
public void ReadFrom(XmlDictionaryReader reader, DictionaryManager dictionaryManager)
{
reader.MoveToStartElement(this.elementName, dictionaryManager.XmlSignatureDictionary.Namespace);
this.prefix = reader.Prefix;
bool isEmptyElement = reader.IsEmptyElement;
this.algorithm = reader.GetAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
if (this.algorithm == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CryptographicException(System.IdentityModel.SR.GetString("RequiredAttributeMissing", new object[] { dictionaryManager.XmlSignatureDictionary.Algorithm, this.elementName })));
}
reader.Read();
reader.MoveToContent();
if (!isEmptyElement)
{
reader.MoveToContent();
reader.ReadEndElement();
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:ElementWithAlgorithmAttribute.cs
示例14: StreamedMessage
public StreamedMessage(XmlDictionaryReader reader, int maxSizeOfHeaders, MessageVersion desiredVersion)
{
if (reader.NodeType != XmlNodeType.Element)
{
reader.MoveToContent();
}
if (desiredVersion.Envelope == EnvelopeVersion.None)
{
this.reader = reader;
this.headerAttributes = XmlAttributeHolder.emptyArray;
this.headers = new MessageHeaders(desiredVersion);
}
else
{
this.envelopeAttributes = XmlAttributeHolder.ReadAttributes(reader, ref maxSizeOfHeaders);
this.envelopePrefix = reader.Prefix;
EnvelopeVersion envelopeVersion = ReceivedMessage.ReadStartEnvelope(reader);
if (desiredVersion.Envelope != envelopeVersion)
{
Exception innerException = new ArgumentException(System.ServiceModel.SR.GetString("EncoderEnvelopeVersionMismatch", new object[] { envelopeVersion, desiredVersion.Envelope }), "reader");
throw TraceUtility.ThrowHelperError(new CommunicationException(innerException.Message, innerException), this);
}
if (ReceivedMessage.HasHeaderElement(reader, envelopeVersion))
{
this.headerPrefix = reader.Prefix;
this.headerAttributes = XmlAttributeHolder.ReadAttributes(reader, ref maxSizeOfHeaders);
this.headers = new MessageHeaders(desiredVersion, reader, this.envelopeAttributes, this.headerAttributes, ref maxSizeOfHeaders);
}
else
{
this.headerAttributes = XmlAttributeHolder.emptyArray;
this.headers = new MessageHeaders(desiredVersion);
}
if (reader.NodeType != XmlNodeType.Element)
{
reader.MoveToContent();
}
this.bodyPrefix = reader.Prefix;
ReceivedMessage.VerifyStartBody(reader, envelopeVersion);
this.bodyAttributes = XmlAttributeHolder.ReadAttributes(reader, ref maxSizeOfHeaders);
if (base.ReadStartBody(reader))
{
this.reader = reader;
}
else
{
this.quotas = new XmlDictionaryReaderQuotas();
reader.Quotas.CopyTo(this.quotas);
reader.Close();
}
}
}
示例15: ReadXml
public virtual void ReadXml(XmlDictionaryReader reader)
{
if (reader == null)
{
throw DiagnosticUtil.ExceptionUtil.ThrowHelperArgumentNull("reader");
}
reader.MoveToContent();
if (reader.IsStartElement("KeyInfo", "http://www.w3.org/2000/09/xmldsig#"))
{
reader.ReadStartElement();
while (reader.IsStartElement())
{
if (reader.IsStartElement("RetrievalMethod", "http://www.w3.org/2000/09/xmldsig#"))
{
string attribute = reader.GetAttribute("URI");
if (!string.IsNullOrEmpty(attribute))
{
this._retrieval = attribute;
}
reader.Skip();
}
else if (this._keyInfoSerializer.CanReadKeyIdentifierClause(reader))
{
this._ski.Add(this._keyInfoSerializer.ReadKeyIdentifierClause(reader));
}
else if (reader.IsStartElement())
{
string str2 = reader.ReadOuterXml();
//if (DiagnosticUtil.TraceUtil.ShouldTrace(TraceEventType.Warning))
//{
// DiagnosticUtil.TraceUtil.TraceString(TraceEventType.Warning, SR.GetString("ID8023", new object[] { reader.Name, reader.NamespaceURI, str2 }), new object[0]);
//}
}
reader.MoveToContent();
}
reader.MoveToContent();
reader.ReadEndElement();
}
}