本文整理汇总了C#中System.Xml.XmlDictionaryReader.ReadOuterXml方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryReader.ReadOuterXml方法的具体用法?C# XmlDictionaryReader.ReadOuterXml怎么用?C# XmlDictionaryReader.ReadOuterXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryReader
的用法示例。
在下文中一共展示了XmlDictionaryReader.ReadOuterXml方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
}
示例2: 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();
}
}
示例3: 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();
}
}
示例4: ReadExtensions
public override void ReadExtensions( XmlDictionaryReader reader )
{
reader.MoveToContent();
if ( reader.IsStartElement( XmlEncryptionConstants.Elements.ReferenceList, XmlEncryptionConstants.Namespace ) )
{
reader.ReadStartElement();
// could have data or key references. these are the only two possible elements sec 3.6 xml enc.
// 3.6 The ReferenceList Element specifies there is a choice. Once one is chosen, it is fixed.
if ( reader.IsStartElement( XmlEncryptionConstants.Elements.DataReference, XmlEncryptionConstants.Namespace ) )
{
while ( reader.IsStartElement() )
{
if ( reader.IsStartElement( XmlEncryptionConstants.Elements.DataReference, XmlEncryptionConstants.Namespace ) )
{
string dataRef = reader.GetAttribute( XmlEncryptionConstants.Attributes.Uri );
if ( !string.IsNullOrEmpty( dataRef ) )
{
_dataReferences.Add( dataRef );
}
reader.Skip();
}
else if ( reader.IsStartElement( XmlEncryptionConstants.Elements.KeyReference, XmlEncryptionConstants.Namespace ) )
{
throw DiagnosticUtility.ThrowHelperXml( reader, SR.GetString( SR.ID4189 ) );
}
else
{
string xml = reader.ReadOuterXml();
if ( DiagnosticUtility.ShouldTraceWarning )
{
TraceUtility.TraceString( System.Diagnostics.TraceEventType.Warning, SR.GetString( SR.ID8024, reader.Name, reader.NamespaceURI, xml ) );
}
}
}
}
else if ( reader.IsStartElement( XmlEncryptionConstants.Elements.KeyReference, XmlEncryptionConstants.Namespace ) )
{
while ( reader.IsStartElement() )
{
if ( reader.IsStartElement( XmlEncryptionConstants.Elements.KeyReference, XmlEncryptionConstants.Namespace ) )
{
string keyRef = reader.GetAttribute( XmlEncryptionConstants.Attributes.Uri );
if ( !string.IsNullOrEmpty( keyRef ) )
{
_keyReferences.Add( keyRef );
}
reader.Skip();
}
else if ( reader.IsStartElement( XmlEncryptionConstants.Elements.DataReference, XmlEncryptionConstants.Namespace ) )
{
throw DiagnosticUtility.ThrowHelperXml( reader, SR.GetString( SR.ID4190 ) );
}
else
{
string xml = reader.ReadOuterXml();
if ( DiagnosticUtility.ShouldTraceWarning )
{
TraceUtility.TraceString( System.Diagnostics.TraceEventType.Warning, SR.GetString( SR.ID8024, reader.Name, reader.NamespaceURI, xml ) );
}
}
}
}
else
{
// there must be at least one reference.
throw DiagnosticUtility.ThrowHelperXml( reader, SR.GetString( SR.ID4191 ) );
}
reader.MoveToContent();
if ( reader.IsStartElement( XmlEncryptionConstants.Elements.CarriedKeyName, XmlEncryptionConstants.Namespace ) )
{
reader.ReadStartElement();
_carriedName = reader.ReadString();
reader.ReadEndElement();
}
// </ReferenceList>
reader.ReadEndElement();
}
}
示例5: SetMetadataReader
public void SetMetadataReader (XmlDictionaryReader reader)
{
if (reader == null)
metadata = null;
else {
reader.MoveToContent ();
metadata = reader.ReadOuterXml ();
}
}
示例6: SetExtensionReader
public void SetExtensionReader (XmlDictionaryReader reader)
{
if (reader == null)
extension = null;
else {
reader.MoveToContent ();
extension = reader.ReadOuterXml ();
}
}
示例7: CreateExceptionOnFault
private static Exception CreateExceptionOnFault(XmlDictionaryReader faultBody)
{
var document = XDocument.Parse(faultBody.ReadOuterXml());
var details = document.Descendants("detail").First();
var type = details.Elements("ExceptionType").FirstOrDefault();
var message = details.Elements("ExceptionMessage").FirstOrDefault();
var info = details.Elements("ExceptionInfo").FirstOrDefault();
return new SoapException(string.Format(
"{0}\n\r{1}\n\r{2}",
message != null ? message.Value : "Not included message.",
type != null ? type.Value : "Not included exception type.",
info != null ? info.Value : "Not included detailed information."), XmlQualifiedName.Empty);
}