本文整理汇总了C#中System.Xml.XmlDictionaryReader.ReadEndElement方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryReader.ReadEndElement方法的具体用法?C# XmlDictionaryReader.ReadEndElement怎么用?C# XmlDictionaryReader.ReadEndElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryReader
的用法示例。
在下文中一共展示了XmlDictionaryReader.ReadEndElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static CloseSequenceResponseInfo Create(XmlDictionaryReader reader)
{
if (reader == null)
{
Fx.Assert("Argument reader cannot be null.");
}
CloseSequenceResponseInfo closeSequenceResponseInfo = new CloseSequenceResponseInfo();
XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(ReliableMessagingVersion.WSReliableMessaging11);
reader.ReadStartElement(DXD.Wsrm11Dictionary.CloseSequenceResponse, wsrmNs);
reader.ReadStartElement(XD.WsrmFeb2005Dictionary.Identifier, wsrmNs);
closeSequenceResponseInfo.Identifier = reader.ReadContentAsUniqueId();
reader.ReadEndElement();
while (reader.IsStartElement())
{
reader.Skip();
}
reader.ReadEndElement();
return closeSequenceResponseInfo;
}
示例2: 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;
}
示例3: 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();
}
示例4: 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
示例5: OnReadBodyContents
protected override void OnReadBodyContents(XmlDictionaryReader reader)
{
base.OnReadBodyContents(reader);
reader.ReadStartElement("ResourceCreated", "http://schemas.xmlsoap.org/ws/2004/09/transfer");
reader.Skip();
reader.ReadStartElement("ReferenceParameters", "http://www.w3.org/2005/08/addressing");
XmlUtility.DeserializeObjectReference(reader, out this._objectReference);
this._instance = reader.ReadElementString("instance", "http://schemas.microsoft.com/2008/1/ActiveDirectory");
reader.ReadEndElement();
reader.ReadEndElement();
DirectoryControlSerializer.Deserialize(reader, out this._controls, false, false);
reader.ReadEndElement();
}
示例6: Create
public static CloseSequenceResponseInfo Create(XmlDictionaryReader reader)
{
CloseSequenceResponseInfo info = new CloseSequenceResponseInfo();
XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(ReliableMessagingVersion.WSReliableMessaging11);
reader.ReadStartElement(DXD.Wsrm11Dictionary.CloseSequenceResponse, namespaceUri);
reader.ReadStartElement(XD.WsrmFeb2005Dictionary.Identifier, namespaceUri);
info.Identifier = reader.ReadContentAsUniqueId();
reader.ReadEndElement();
while (reader.IsStartElement())
{
reader.Skip();
}
reader.ReadEndElement();
return info;
}
示例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();
}
}
示例8: ReadObject
public override object ReadObject(XmlDictionaryReader reader, bool verifyObjectName)
{
reader.ReadStartElement("Data");
var data = reader.ReadContentAsBase64();
reader.ReadEndElement();
return DecodeObject(data);
}
示例9: BinaryBodyReader
public BinaryBodyReader(XmlDictionaryReader reader)
{
reader.ReadStartElement(BinaryElementName);
_data = reader.ReadContentAsBase64();
if (reader.NodeType == XmlNodeType.Text) reader.Read();
reader.ReadEndElement();
}
示例10: OnReadBodyContents
protected override void OnReadBodyContents(XmlDictionaryReader reader)
{
reader.ReadStartElement("BaseObjectSearchResponse", "http://schemas.microsoft.com/2006/11/IdentityManagement/DirectoryAccess");
ResultSerializer.Deserialize(reader, ResultSerializer.ResultDialect.XPath1, out this._entry);
DirectoryControlSerializer.Deserialize(reader, out this._controls, false, false);
reader.ReadEndElement();
}
示例11: 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)));
}
示例12: 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();
}
示例13: 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;
}
示例14: 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);
}
示例15: ReadFrom
public static IdentifierHeader ReadFrom(XmlDictionaryReader reader)
{
reader.ReadStartElement(ElementName, EventingActions.Namespace);
string result = reader.Value;
reader.Read();
reader.ReadEndElement();
return new IdentifierHeader(result);
}