本文整理汇总了C#中System.Xml.XmlDictionaryReader.ReadStartElement方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryReader.ReadStartElement方法的具体用法?C# XmlDictionaryReader.ReadStartElement怎么用?C# XmlDictionaryReader.ReadStartElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryReader
的用法示例。
在下文中一共展示了XmlDictionaryReader.ReadStartElement方法的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: 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;
}
示例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: 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();
}
示例8: 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)));
}
示例9: ReadObject
public override object ReadObject(XmlDictionaryReader reader, bool verifyObjectName)
{
reader.ReadStartElement("Data");
var data = reader.ReadContentAsBase64();
reader.ReadEndElement();
return DecodeObject(data);
}
示例10: BinaryBodyReader
public BinaryBodyReader(XmlDictionaryReader reader)
{
reader.ReadStartElement(BinaryElementName);
_data = reader.ReadContentAsBase64();
if (reader.NodeType == XmlNodeType.Text) reader.Read();
reader.ReadEndElement();
}
示例11: ReadFrom
public static IdentifierHeader ReadFrom(XmlDictionaryReader reader)
{
reader.ReadStartElement(ElementName, EventingActions.Namespace);
string result = reader.Value;
reader.Read();
reader.ReadEndElement();
return new IdentifierHeader(result);
}
示例12: 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);
}
示例13: ReadFrom
public static TotalItemsCountEstimate ReadFrom(XmlDictionaryReader reader)
{
reader.ReadStartElement(ElementName, ManagementNamespaces.Namespace);
int value = XmlConvert.ToInt32(reader.ReadString());
TotalItemsCountEstimate result = new TotalItemsCountEstimate(value);
reader.ReadEndElement();
return result;
}
示例14: ReadFrom
public static ResourceUriHeader ReadFrom(XmlDictionaryReader reader)
{
reader.ReadStartElement(ElementName, ManagementNamespaces.Namespace);
string result = reader.Value;
reader.Read();
reader.ReadEndElement();
return new ResourceUriHeader(result);
}
示例15: ReadHeaderValue
static PollingDuplexSession ReadHeaderValue(XmlDictionaryReader reader)
{
string str = null;
string str2 = null;
if (reader.IsStartElement("Duplex", "http://schemas.microsoft.com/2008/04/netduplex"))
{
reader.ReadStartElement();
reader.MoveToContent();
while (reader.IsStartElement())
{
if (reader.IsStartElement("SessionId", "http://schemas.microsoft.com/2008/04/netduplex"))
{
if (!string.IsNullOrEmpty(str2))
{
throw new InvalidOperationException("Multiple sessionId elements in a duplex header.");
}
str2 = reader.ReadElementContentAsString();
if (string.IsNullOrEmpty(str2))
{
throw new InvalidOperationException("Invalid sessionId element content in a duplex header.");
}
}
else
{
if (reader.IsStartElement("Address", "http://schemas.microsoft.com/2008/04/netduplex"))
{
if (!string.IsNullOrEmpty(str))
{
throw new InvalidOperationException("Multiple address elements in a duplex header.");
}
str = reader.ReadElementContentAsString();
if (string.IsNullOrEmpty(str))
{
throw new InvalidOperationException("Invalid address element in a duplex header.");
}
continue;
}
if (reader.IsStartElement("CloseSession", "http://schemas.microsoft.com/2008/04/netduplex"))
{
reader.Skip();
continue;
}
reader.Skip();
}
}
reader.ReadEndElement();
}
if (str == null)
{
throw new InvalidOperationException("Missing address in a duplex header.");
}
if (str2 == null)
{
throw new InvalidOperationException("Missing sessionId in a duplex header.");
}
return new PollingDuplexSession(str, str2);
}