本文整理汇总了C#中System.Xml.XmlDictionaryReader.Read方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryReader.Read方法的具体用法?C# XmlDictionaryReader.Read怎么用?C# XmlDictionaryReader.Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryReader
的用法示例。
在下文中一共展示了XmlDictionaryReader.Read方法的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: 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: 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;
}
示例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: 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;
}
示例7: BinaryBodyReader
public BinaryBodyReader(XmlDictionaryReader reader)
{
reader.ReadStartElement(BinaryElementName);
_data = reader.ReadContentAsBase64();
if (reader.NodeType == XmlNodeType.Text) reader.Read();
reader.ReadEndElement();
}
示例8: ReadFrom
public static IdentifierHeader ReadFrom(XmlDictionaryReader reader)
{
reader.ReadStartElement(ElementName, EventingActions.Namespace);
string result = reader.Value;
reader.Read();
reader.ReadEndElement();
return new IdentifierHeader(result);
}
示例9: DeserializeJsonAsFlatDictionary
/// <summary>
/// Reads JSON as a flat dictionary into a message.
/// </summary>
/// <param name="messageDictionary">The message dictionary to fill with the JSON-deserialized data.</param>
/// <param name="reader">The JSON reader.</param>
internal static void DeserializeJsonAsFlatDictionary(IDictionary<string, string> messageDictionary, XmlDictionaryReader reader) {
Requires.NotNull(messageDictionary, "messageDictionary");
Requires.NotNull(reader, "reader");
reader.Read(); // one extra one to skip the root node.
while (reader.Read()) {
if (reader.NodeType == XmlNodeType.EndElement) {
// This is likely the closing </root> tag.
continue;
}
string key = reader.Name;
reader.Read();
string value = reader.ReadContentAsString();
messageDictionary[key] = value;
}
}
示例10: ReadFrom
public static ResourceUriHeader ReadFrom(XmlDictionaryReader reader)
{
reader.ReadStartElement(ElementName, ManagementNamespaces.Namespace);
string result = reader.Value;
reader.Read();
reader.ReadEndElement();
return new ResourceUriHeader(result);
}
示例11: 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;
}
示例12: OnReadBodyContents
protected override void OnReadBodyContents(XmlDictionaryReader reader)
{
base.OnReadBodyContents(reader);
XmlReader xmlReader = reader.ReadSubtree();
using (xmlReader)
{
xmlReader.Read();
ResultSerializer.Deserialize(xmlReader, ResultSerializer.ResultDialect.WSTransfer, out this._entry);
}
reader.Read();
DirectoryControlSerializer.Deserialize(reader, out this._controls, false, false);
reader.ReadEndElement();
}
示例13: ReadFrom
public static FragmentTransferHeader ReadFrom(XmlDictionaryReader reader)
{
reader.ReadStartElement(ElementName, Const.ManagementNamespace);
StringBuilder fragment = new StringBuilder();
while (reader.NodeType == XmlNodeType.Text)
{
fragment.Append(reader.Value);
reader.Read();
}
FragmentTransferHeader result = new FragmentTransferHeader(fragment.ToString());
reader.ReadEndElement();
return result;
}
示例14: ReadAnd
private Expression<Func<ClaimsPrincipal, bool>> ReadAnd(XmlDictionaryReader rdr, ParameterExpression subject)
{
rdr.Read();
BinaryExpression lambda1 = Expression.AndAlso(
Expression.Invoke(ReadNode(rdr, subject), subject),
Expression.Invoke(ReadNode(rdr, subject), subject));
rdr.ReadEndElement();
Expression<Func<ClaimsPrincipal, bool>> lambda2 = Expression.Lambda<Func<ClaimsPrincipal, bool>>(lambda1, subject);
return lambda2;
}
示例15: ReadFrom
public static MaxEnvelopeSizeHeader ReadFrom(XmlDictionaryReader reader)
{
reader.ReadStartElement(ElementName, Const.ManagementNamespace);
var fragment = new StringBuilder();
while (reader.NodeType == XmlNodeType.Text)
{
fragment.Append(reader.Value);
reader.Read();
}
var result = new MaxEnvelopeSizeHeader(int.Parse(fragment.ToString()));
reader.ReadEndElement();
return result;
}