protected ReadContentAsString ( int maxStringContentLength ) : string | ||
maxStringContentLength | int | |
return | string |
protected string ReadContentAsString(int maxStringContentLength)
{
StringBuilder sb = null;
string result = string.Empty;
bool done = false;
while (true)
{
switch (this.NodeType)
{
case XmlNodeType.Attribute:
result = this.Value;
break;
case XmlNodeType.Text:
case XmlNodeType.Whitespace:
case XmlNodeType.SignificantWhitespace:
case XmlNodeType.CDATA:
// merge text content
string value = this.Value;
if (result.Length == 0)
{
result = value;
}
else
{
if (sb == null)
sb = new StringBuilder(result);
sb.Append(value);
}
break;
case XmlNodeType.ProcessingInstruction:
case XmlNodeType.Comment:
case XmlNodeType.EndEntity:
// skip comments, pis and end entity nodes
break;
case XmlNodeType.EntityReference:
if (this.CanResolveEntity)
{
this.ResolveEntity();
break;
}
goto default;
case XmlNodeType.Element:
case XmlNodeType.EndElement:
default:
done = true;
break;
}
if (done)
break;
if (this.AttributeCount != 0)
ReadAttributeValue();
else
Read();
}
if (sb != null)
result = sb.ToString();
return result;
}
XmlDictionaryReader::ReadContentAsString ( ) : string | |
XmlDictionaryReader::ReadContentAsString ( System strings, int &index ) : string | |
XmlDictionaryReader::ReadContentAsString ( |
|
XmlDictionaryReader::ReadContentAsString ( string strings, int &index ) : string |
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))); }