本文整理汇总了C#中System.Xml.XmlDictionaryReader.GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryReader.GetAttribute方法的具体用法?C# XmlDictionaryReader.GetAttribute怎么用?C# XmlDictionaryReader.GetAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryReader
的用法示例。
在下文中一共展示了XmlDictionaryReader.GetAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadFrom
public void ReadFrom(XmlDictionaryReader reader, long maxBufferSize)
{
this.ValidateReadState();
reader.MoveToStartElement(this.OpeningElementName, NamespaceUri);
this.encoding = reader.GetAttribute(EncodingAttribute, null);
this.id = reader.GetAttribute(System.ServiceModel.XD.XmlEncryptionDictionary.Id, null) ?? System.ServiceModel.Security.SecurityUniqueId.Create().Value;
this.wsuId = reader.GetAttribute(System.ServiceModel.XD.XmlEncryptionDictionary.Id, System.ServiceModel.XD.UtilityDictionary.Namespace) ?? System.ServiceModel.Security.SecurityUniqueId.Create().Value;
this.mimeType = reader.GetAttribute(MimeTypeAttribute, null);
this.type = reader.GetAttribute(TypeAttribute, null);
this.ReadAdditionalAttributes(reader);
reader.Read();
if (reader.IsStartElement(EncryptionMethodElement.ElementName, NamespaceUri))
{
this.encryptionMethod.ReadFrom(reader);
}
if (this.tokenSerializer.CanReadKeyIdentifier(reader))
{
this.KeyIdentifier = this.tokenSerializer.ReadKeyIdentifier(reader);
}
reader.ReadStartElement(CipherDataElementName, NamespaceUri);
reader.ReadStartElement(CipherValueElementName, NamespaceUri);
if (maxBufferSize == 0L)
{
this.ReadCipherData(reader);
}
else
{
this.ReadCipherData(reader, maxBufferSize);
}
reader.ReadEndElement();
reader.ReadEndElement();
this.ReadAdditionalElements(reader);
reader.ReadEndElement();
this.State = EncryptionState.Read;
}
示例2: ReadClaim
private Expression<Func<ClaimsPrincipal, bool>> ReadClaim(XmlDictionaryReader rdr)
{
string claimType = rdr.GetAttribute("claimType");
string claimValue = rdr.GetAttribute("claimValue");
Expression<Func<ClaimsPrincipal, bool>> hasClaim = icp => HasClaim(icp, claimType, claimValue);
rdr.Read();
return hasClaim;
}
示例3: 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;
}
}
示例4: 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')");
}
示例5: 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();
}
}
示例6: ReadXml
public virtual void ReadXml(XmlDictionaryReader reader, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer, SecurityTokenResolver outOfBandTokenResolver)
{
string str2;
string str3;
if (reader == null)
{
throw System.IdentityModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("reader"));
}
if (samlSerializer == null)
{
throw System.IdentityModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSerializer"));
}
SamlDictionary samlDictionary = samlSerializer.DictionaryManager.SamlDictionary;
string attribute = reader.GetAttribute(samlDictionary.AuthorityKind, null);
if (string.IsNullOrEmpty(attribute))
{
throw System.IdentityModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(System.IdentityModel.SR.GetString("SAMLAuthorityBindingMissingAuthorityKindOnRead")));
}
string[] strArray = attribute.Split(new char[] { ':' });
if (strArray.Length > 2)
{
throw System.IdentityModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(System.IdentityModel.SR.GetString("SAMLAuthorityBindingInvalidAuthorityKind")));
}
if (strArray.Length == 2)
{
str3 = strArray[0];
str2 = strArray[1];
}
else
{
str3 = string.Empty;
str2 = strArray[0];
}
string ns = reader.LookupNamespace(str3);
this.authorityKind = new XmlQualifiedName(str2, ns);
this.binding = reader.GetAttribute(samlDictionary.Binding, null);
if (string.IsNullOrEmpty(this.binding))
{
throw System.IdentityModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(System.IdentityModel.SR.GetString("SAMLAuthorityBindingMissingBindingOnRead")));
}
this.location = reader.GetAttribute(samlDictionary.Location, null);
if (string.IsNullOrEmpty(this.location))
{
throw System.IdentityModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(System.IdentityModel.SR.GetString("SAMLAuthorityBindingMissingLocationOnRead")));
}
if (reader.IsEmptyElement)
{
reader.MoveToContent();
reader.Read();
}
else
{
reader.MoveToContent();
reader.Read();
reader.ReadEndElement();
}
}
示例7: 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"));
}
SamlDictionary samlDictionary = samlSerializer.DictionaryManager.SamlDictionary;
string attribute = reader.GetAttribute(samlDictionary.NotBefore, null);
if (!string.IsNullOrEmpty(attribute))
{
this.notBefore = DateTime.ParseExact(attribute, SamlConstants.AcceptedDateTimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None).ToUniversalTime();
}
attribute = reader.GetAttribute(samlDictionary.NotOnOrAfter, null);
if (!string.IsNullOrEmpty(attribute))
{
this.notOnOrAfter = DateTime.ParseExact(attribute, SamlConstants.AcceptedDateTimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None).ToUniversalTime();
}
if (reader.IsEmptyElement)
{
reader.MoveToContent();
reader.Read();
}
else
{
reader.MoveToContent();
reader.Read();
while (reader.IsStartElement())
{
SamlCondition item = samlSerializer.LoadCondition(reader, keyInfoSerializer, outOfBandTokenResolver);
if (item == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(System.IdentityModel.SR.GetString("SAMLUnableToLoadCondtion")));
}
this.conditions.Add(item);
}
reader.MoveToContent();
reader.ReadEndElement();
}
}
示例8: ReadFrom
public void ReadFrom(XmlDictionaryReader reader, DictionaryManager dictionaryManager)
{
reader.MoveToStartElement(dictionaryManager.XmlSignatureDictionary.Signature, dictionaryManager.XmlSignatureDictionary.Namespace);
this.prefix = reader.Prefix;
this.Id = reader.GetAttribute(dictionaryManager.UtilityDictionary.IdAttribute, null);
reader.Read();
this.signedInfo.ReadFrom(reader, this.signedXml.TransformFactory, dictionaryManager);
this.signatureValueElement.ReadFrom(reader, dictionaryManager);
if (this.signedXml.SecurityTokenSerializer.CanReadKeyIdentifier(reader))
{
this.keyIdentifier = this.signedXml.SecurityTokenSerializer.ReadKeyIdentifier(reader);
}
reader.ReadEndElement();
}
示例9: 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();
}
}
示例10: ReadEmptyElementAndRequiredAttribute
internal static string ReadEmptyElementAndRequiredAttribute(XmlDictionaryReader reader, XmlDictionaryString name, XmlDictionaryString namespaceUri, XmlDictionaryString attributeName, out string prefix)
{
reader.MoveToStartElement(name, namespaceUri);
prefix = reader.Prefix;
bool isEmptyElement = reader.IsEmptyElement;
string attribute = reader.GetAttribute(attributeName, null);
if (attribute == null)
{
OnRequiredAttributeMissing(attributeName.Value, null);
}
reader.Read();
if (!isEmptyElement)
{
reader.ReadEndElement();
}
return attribute;
}
示例11: ReadKeyIdentifierClauseCore
public override SecurityKeyIdentifierClause ReadKeyIdentifierClauseCore(XmlDictionaryReader reader)
{
string encryptionMethod = null;
string carriedKeyName = null;
SecurityKeyIdentifier encryptingKeyIdentifier = null;
byte[] encryptedKey = null;
reader.ReadStartElement(XD.XmlEncryptionDictionary.EncryptedKey, NamespaceUri);
if (reader.IsStartElement(XD.XmlEncryptionDictionary.EncryptionMethod, NamespaceUri))
{
encryptionMethod = reader.GetAttribute(XD.XmlEncryptionDictionary.AlgorithmAttribute, null);
bool isEmptyElement = reader.IsEmptyElement;
reader.ReadStartElement();
if (!isEmptyElement)
{
while (reader.IsStartElement())
{
reader.Skip();
}
reader.ReadEndElement();
}
}
if (this.securityTokenSerializer.CanReadKeyIdentifier(reader))
{
encryptingKeyIdentifier = this.securityTokenSerializer.ReadKeyIdentifier(reader);
}
reader.ReadStartElement(XD.XmlEncryptionDictionary.CipherData, NamespaceUri);
reader.ReadStartElement(XD.XmlEncryptionDictionary.CipherValue, NamespaceUri);
encryptedKey = reader.ReadContentAsBase64();
reader.ReadEndElement();
reader.ReadEndElement();
if (reader.IsStartElement(XD.XmlEncryptionDictionary.CarriedKeyName, NamespaceUri))
{
reader.ReadStartElement();
carriedKeyName = reader.ReadString();
reader.ReadEndElement();
}
reader.ReadEndElement();
return new EncryptedKeyIdentifierClause(encryptedKey, encryptionMethod, encryptingKeyIdentifier, carriedKeyName);
}
示例12: 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
示例13: ReadFrom
public void ReadFrom(XmlDictionaryReader reader, TransformFactory transformFactory, DictionaryManager dictionaryManager)
{
reader.MoveToStartElement(dictionaryManager.XmlSignatureDictionary.Transforms, dictionaryManager.XmlSignatureDictionary.Namespace);
this.prefix = reader.Prefix;
reader.Read();
while (reader.IsStartElement(dictionaryManager.XmlSignatureDictionary.Transform, dictionaryManager.XmlSignatureDictionary.Namespace))
{
string attribute = reader.GetAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
Transform transform = transformFactory.CreateTransform(attribute);
transform.ReadFrom(reader, dictionaryManager);
this.Add(transform);
}
reader.MoveToContent();
reader.ReadEndElement();
if (this.TransformCount == 0)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CryptographicException(System.IdentityModel.SR.GetString("AtLeastOneTransformRequired")));
}
}
示例14: 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();
}
}
示例15: 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"));
}
SamlDictionary samlDictionary = samlSerializer.DictionaryManager.SamlDictionary;
if (reader.IsStartElement(samlDictionary.Action, samlDictionary.Namespace))
{
this.ns = reader.GetAttribute(samlDictionary.ActionNamespaceAttribute, null);
reader.MoveToContent();
this.action = reader.ReadString();
if (string.IsNullOrEmpty(this.action))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(System.IdentityModel.SR.GetString("SAMLActionNameRequiredOnRead")));
}
reader.MoveToContent();
reader.ReadEndElement();
}
}