本文整理汇总了C#中System.Xml.XmlDictionaryReader.IsStartElement方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryReader.IsStartElement方法的具体用法?C# XmlDictionaryReader.IsStartElement怎么用?C# XmlDictionaryReader.IsStartElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryReader
的用法示例。
在下文中一共展示了XmlDictionaryReader.IsStartElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadStatement
public virtual SamlStatement LoadStatement(XmlDictionaryReader reader, SecurityTokenSerializer keyInfoSerializer, SecurityTokenResolver outOfBandTokenResolver)
{
if (reader == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader");
}
if (reader.IsStartElement(this.DictionaryManager.SamlDictionary.AuthenticationStatement, this.DictionaryManager.SamlDictionary.Namespace))
{
SamlAuthenticationStatement statement = new SamlAuthenticationStatement();
statement.ReadXml(reader, this, keyInfoSerializer, outOfBandTokenResolver);
return statement;
}
if (reader.IsStartElement(this.DictionaryManager.SamlDictionary.AttributeStatement, this.DictionaryManager.SamlDictionary.Namespace))
{
SamlAttributeStatement statement2 = new SamlAttributeStatement();
statement2.ReadXml(reader, this, keyInfoSerializer, outOfBandTokenResolver);
return statement2;
}
if (!reader.IsStartElement(this.DictionaryManager.SamlDictionary.AuthorizationDecisionStatement, this.DictionaryManager.SamlDictionary.Namespace))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(System.IdentityModel.SR.GetString("SAMLUnableToLoadUnknownElement", new object[] { reader.LocalName })));
}
SamlAuthorizationDecisionStatement statement3 = new SamlAuthorizationDecisionStatement();
statement3.ReadXml(reader, this, keyInfoSerializer, outOfBandTokenResolver);
return statement3;
}
示例2: Create
public static CloseSequenceInfo Create(XmlDictionaryReader reader)
{
if (reader == null)
{
Fx.Assert("Argument reader cannot be null.");
}
CloseSequenceInfo closeSequenceInfo = new CloseSequenceInfo();
XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(ReliableMessagingVersion.WSReliableMessaging11);
Wsrm11Dictionary wsrm11Dictionary = DXD.Wsrm11Dictionary;
reader.ReadStartElement(wsrm11Dictionary.CloseSequence, wsrmNs);
reader.ReadStartElement(XD.WsrmFeb2005Dictionary.Identifier, wsrmNs);
closeSequenceInfo.Identifier = reader.ReadContentAsUniqueId();
reader.ReadEndElement();
if (reader.IsStartElement(wsrm11Dictionary.LastMsgNumber, wsrmNs))
{
reader.ReadStartElement();
closeSequenceInfo.LastMsgNumber = WsrmUtilities.ReadSequenceNumber(reader, false);
reader.ReadEndElement();
}
while (reader.IsStartElement())
{
reader.Skip();
}
reader.ReadEndElement();
return closeSequenceInfo;
}
示例3: 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);
}
示例4: IsStartObject
public override bool IsStartObject(XmlDictionaryReader reader)
{
if (reader == null)
{
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("reader"));
}
reader.MoveToElement();
if (this.rootName != null)
{
return reader.IsStartElement(this.rootName, this.rootNamespace);
}
return reader.IsStartElement();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:XmlSerializerObjectSerializer.cs
示例5: Create
public static MakeConnectionMessageInfo Create(XmlDictionaryReader reader)
{
MakeConnectionMessageInfo makeConnectionInfo = new MakeConnectionMessageInfo();
if (reader.IsStartElement(MakeConnectionConstants.MakeConnectionMessage.Name, MakeConnectionConstants.Namespace))
{
reader.ReadStartElement();
reader.MoveToContent();
while (reader.IsStartElement())
{
if (reader.IsStartElement(MakeConnectionConstants.MakeConnectionMessage.AddressElement, MakeConnectionConstants.Namespace))
{
if (!string.IsNullOrEmpty(makeConnectionInfo.Address))
{
makeConnectionInfo.MultipleAddressHeaders = true;
reader.Skip();
}
else
{
makeConnectionInfo.Address = reader.ReadElementContentAsString();
}
}
else if (reader.IsStartElement(MakeConnectionConstants.MakeConnectionMessage.IdentifierElement, MakeConnectionConstants.Namespace))
{
if (makeConnectionInfo.Identifier != null)
{
makeConnectionInfo.MultipleIdentifierHeaders = true;
reader.Skip();
}
else
{
makeConnectionInfo.Identifier = reader.ReadElementContentAsUniqueId();
}
}
else
{
if (string.IsNullOrEmpty(makeConnectionInfo.UnknownSelection))
{
makeConnectionInfo.UnknownSelection = reader.LocalName;
}
reader.Skip();
}
}
reader.ReadEndElement();
}
return makeConnectionInfo;
}
示例6: Deserialize
public static void Deserialize(XmlDictionaryReader reader, out IList<DirectoryControl> controls, bool mustBePresent, bool fullChecks)
{
string str = null;
string str1 = null;
bool flag;
byte[] numArray = null;
controls = new List<DirectoryControl>();
if (mustBePresent || reader.IsStartElement("controls", "http://schemas.microsoft.com/2008/1/ActiveDirectory"))
{
reader.ReadFullStartElement("controls", "http://schemas.microsoft.com/2008/1/ActiveDirectory");
while (reader.IsStartElement("control", "http://schemas.microsoft.com/2008/1/ActiveDirectory"))
{
string attribute = reader.GetAttribute("type");
string attribute1 = reader.GetAttribute("criticality");
reader.Read();
if (!reader.IsStartElement("controlValue", "http://schemas.microsoft.com/2008/1/ActiveDirectory"))
{
numArray = null;
}
else
{
string attribute2 = reader.GetAttribute("type", "http://www.w3.org/2001/XMLSchema-instance");
if (attribute2 != null)
{
XmlUtility.SplitPrefix(attribute2, out str, out str1);
numArray = reader.ReadElementContentAsBase64();
}
else
{
throw new ArgumentException();
}
}
if (!string.Equals("true", attribute1))
{
flag = false;
}
else
{
flag = true;
}
DirectoryControl directoryControl = new DirectoryControl(attribute, numArray, flag, true);
controls.Add(directoryControl);
reader.Read();
}
return;
}
else
{
return;
}
}
示例7: ReadAdditionalElements
protected override void ReadAdditionalElements(XmlDictionaryReader reader)
{
if (reader.IsStartElement(System.ServiceModel.Security.ReferenceList.ElementName, EncryptedType.NamespaceUri))
{
this.referenceList = new System.ServiceModel.Security.ReferenceList();
this.referenceList.ReadFrom(reader);
}
if (reader.IsStartElement(CarriedKeyElementName, EncryptedType.NamespaceUri))
{
reader.ReadStartElement(CarriedKeyElementName, EncryptedType.NamespaceUri);
this.carriedKeyName = reader.ReadString();
reader.ReadEndElement();
}
}
示例8: ReadNode
/// <summary>
/// Read the policy node
/// </summary>
/// <param name="rdr">XmlDictionaryReader for the policy Xml</param>
/// <param name="subject">ClaimsPrincipal subject</param>
/// <returns>A LINQ expression created from the policy</returns>
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;
}
示例9: 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();
}
}
示例10: 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();
}
示例11: VerifyStartBody
protected static void VerifyStartBody(XmlDictionaryReader reader, EnvelopeVersion version)
{
if (!reader.IsStartElement(XD.MessageDictionary.Body, version.DictionaryNamespace))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CommunicationException(System.ServiceModel.SR.GetString("MessageBodyMissing")));
}
}
示例12: 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();
}
}
示例13: 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;
}
示例14: 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();
}
示例15: 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)));
}