本文整理汇总了C#中System.Xml.XmlDictionaryWriter.WriteStartElement方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryWriter.WriteStartElement方法的具体用法?C# XmlDictionaryWriter.WriteStartElement怎么用?C# XmlDictionaryWriter.WriteStartElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryWriter
的用法示例。
在下文中一共展示了XmlDictionaryWriter.WriteStartElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteKeyIdentifierClauseCore
public override void WriteKeyIdentifierClauseCore(XmlDictionaryWriter writer, SecurityKeyIdentifierClause keyIdentifierClause)
{
EncryptedKeyIdentifierClause clause = keyIdentifierClause as EncryptedKeyIdentifierClause;
writer.WriteStartElement(XD.XmlEncryptionDictionary.Prefix.Value, XD.XmlEncryptionDictionary.EncryptedKey, this.NamespaceUri);
if (clause.EncryptionMethod != null)
{
writer.WriteStartElement(XD.XmlEncryptionDictionary.Prefix.Value, XD.XmlEncryptionDictionary.EncryptionMethod, this.NamespaceUri);
writer.WriteAttributeString(XD.XmlEncryptionDictionary.AlgorithmAttribute, null, clause.EncryptionMethod);
if (clause.EncryptionMethod == XD.SecurityAlgorithmDictionary.RsaOaepKeyWrap.Value)
{
writer.WriteStartElement("", XD.XmlSignatureDictionary.DigestMethod, XD.XmlSignatureDictionary.Namespace);
writer.WriteAttributeString(XD.XmlSignatureDictionary.Algorithm, null, "http://www.w3.org/2000/09/xmldsig#sha1");
writer.WriteEndElement();
}
writer.WriteEndElement();
}
if (clause.EncryptingKeyIdentifier != null)
{
this.tokenSerializer.WriteKeyIdentifier(writer, clause.EncryptingKeyIdentifier);
}
writer.WriteStartElement(XD.XmlEncryptionDictionary.Prefix.Value, XD.XmlEncryptionDictionary.CipherData, this.NamespaceUri);
writer.WriteStartElement(XD.XmlEncryptionDictionary.Prefix.Value, XD.XmlEncryptionDictionary.CipherValue, this.NamespaceUri);
byte[] encryptedKey = clause.GetEncryptedKey();
writer.WriteBase64(encryptedKey, 0, encryptedKey.Length);
writer.WriteEndElement();
writer.WriteEndElement();
if (clause.CarriedKeyName != null)
{
writer.WriteElementString(XD.XmlEncryptionDictionary.Prefix.Value, XD.XmlEncryptionDictionary.CarriedKeyName, this.NamespaceUri, clause.CarriedKeyName);
}
writer.WriteEndElement();
}
示例2: OnWriteAddressHeaderContents
protected override void OnWriteAddressHeaderContents (XmlDictionaryWriter writer)
{
writer.WriteStartElement(XD.DotNetAtomicTransactionExternalDictionary.LocalTransactionId,
XD.DotNetAtomicTransactionExternalDictionary.Namespace);
writer.WriteValue(this.transactionId);
writer.WriteEndElement();
if (this.contextId != null)
{
writer.WriteStartElement(XD.DotNetAtomicTransactionExternalDictionary.ContextId,
XD.DotNetAtomicTransactionExternalDictionary.Namespace);
writer.WriteValue(this.contextId);
writer.WriteEndElement();
}
if (this.tokenId != null)
{
writer.WriteStartElement(XD.DotNetAtomicTransactionExternalDictionary.TokenId,
XD.DotNetAtomicTransactionExternalDictionary.Namespace);
writer.WriteValue(this.tokenId);
writer.WriteEndElement();
}
}
示例3: OnWriteBodyContents
protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
{
WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary;
XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(this.reliableMessagingVersion);
writer.WriteStartElement(dictionary.CreateSequenceResponse, namespaceUri);
writer.WriteStartElement(dictionary.Identifier, namespaceUri);
writer.WriteValue(this.identifier);
writer.WriteEndElement();
if (this.expires.HasValue)
{
writer.WriteStartElement(dictionary.Expires, namespaceUri);
writer.WriteValue(this.expires.Value);
writer.WriteEndElement();
}
if (this.reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11)
{
Wsrm11Dictionary dictionary2 = DXD.Wsrm11Dictionary;
writer.WriteStartElement(dictionary2.IncompleteSequenceBehavior, namespaceUri);
writer.WriteValue(this.ordered ? dictionary2.DiscardFollowingFirstGap : dictionary2.NoDiscard);
writer.WriteEndElement();
}
if (this.acceptAcksTo != null)
{
writer.WriteStartElement(dictionary.Accept, namespaceUri);
this.acceptAcksTo.WriteTo(this.addressingVersion, writer, dictionary.AcksTo, namespaceUri);
writer.WriteEndElement();
}
writer.WriteEndElement();
}
示例4: WriteHeader
private void WriteHeader(XmlDictionaryWriter writer)
{
var nonce = new byte[64];
RandomNumberGenerator.Create().GetBytes(nonce);
string created = DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss.msZ");
writer.WriteStartElement("wsse", "UsernameToken", null);
writer.WriteAttributeString("wsu:Id", "UsernameToken-1");
writer.WriteStartElement("wsse", "Username", null);
writer.WriteString(SystemUser);
writer.WriteEndElement();//End Username
writer.WriteStartElement("wsse", "Password", null);
writer.WriteAttributeString("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest");
writer.WriteString(ComputePasswordDigest(SystemPassword, nonce, created));
writer.WriteEndElement();//End Password
writer.WriteStartElement("wsse", "Nonce", null);
writer.WriteAttributeString("EncodingType", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary");
writer.WriteBase64(nonce, 0, nonce.Length);
writer.WriteEndElement();//End Nonce
writer.WriteStartElement("wsu", "Created", null);
writer.WriteString(created);
writer.WriteEndElement();//End Created
writer.WriteEndElement();//End UsernameToken
writer.Flush();
}
示例5: WriteJson
public void WriteJson(XmlDictionaryWriter writer)
{
writer.WriteStartElement(MetadataStrings.TypeString);
writer.WriteAttributeString("type", "string");
writer.WriteString(String.Format("{0}{1}{2}", this.TypeName, MetadataStrings.NamespaceMarker, this.TypeNamespace));
writer.WriteEndElement();
writer.WriteStartElement(MetadataStrings.KeyString);
writer.WriteAttributeString("type", "array");
foreach (string keyitem in this.Key)
{
writer.WriteStartElement("item");
writer.WriteAttributeString("type", "string");
writer.WriteValue(keyitem);
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteStartElement(MetadataStrings.FieldsString);
writer.WriteAttributeString("type", "object");
foreach (TypePropertyMetadata field in this.Properties)
{
field.WriteJson(writer);
}
writer.WriteEndElement();
this.WriteValidationRulesMetadata(writer);
}
示例6: WriteAckRanges
internal static void WriteAckRanges(XmlDictionaryWriter writer, ReliableMessagingVersion reliableMessagingVersion, UniqueId sequenceId, SequenceRangeCollection ranges)
{
WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary;
XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion);
writer.WriteStartElement(dictionary.Identifier, namespaceUri);
writer.WriteValue(sequenceId);
writer.WriteEndElement();
if (ranges.Count == 0)
{
if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005)
{
ranges = ranges.MergeWith((long) 0L);
}
else if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11)
{
writer.WriteStartElement(DXD.Wsrm11Dictionary.None, namespaceUri);
writer.WriteEndElement();
}
}
for (int i = 0; i < ranges.Count; i++)
{
writer.WriteStartElement(dictionary.AcknowledgementRange, namespaceUri);
writer.WriteStartAttribute(dictionary.Lower, null);
SequenceRange range = ranges[i];
writer.WriteValue(range.Lower);
writer.WriteEndAttribute();
writer.WriteStartAttribute(dictionary.Upper, null);
SequenceRange range2 = ranges[i];
writer.WriteValue(range2.Upper);
writer.WriteEndAttribute();
writer.WriteEndElement();
}
}
示例7: OnWriteBodyContents
protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
{
XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(ReliableMessagingVersion.WSReliableMessaging11);
writer.WriteStartElement(DXD.Wsrm11Dictionary.CloseSequenceResponse, namespaceUri);
writer.WriteStartElement(XD.WsrmFeb2005Dictionary.Identifier, namespaceUri);
writer.WriteValue(this.identifier);
writer.WriteEndElement();
writer.WriteEndElement();
}
示例8: GetStreamAndWriteStartWrapperIfNecessaryAsync
private Task<Stream> GetStreamAndWriteStartWrapperIfNecessaryAsync(XmlDictionaryWriter writer, object[] parameters, object returnValue)
{
Stream streamValue = GetStreamValue(parameters, returnValue);
if (streamValue == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(_partName);
if (WrapperName != null)
writer.WriteStartElement(null, WrapperName, WrapperNamespace);
writer.WriteStartElement(null, PartName, PartNamespace);
return Task.FromResult(streamValue);
}
示例9: GetStreamAndWriteStartWrapperIfNecessary
Stream GetStreamAndWriteStartWrapperIfNecessary(XmlDictionaryWriter writer, object[] parameters, object returnValue)
{
Stream streamValue = GetStreamValue(parameters, returnValue);
if (streamValue == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(partName);
if (WrapperName != null)
writer.WriteStartElement(WrapperName, WrapperNamespace);
writer.WriteStartElement(PartName, PartNamespace);
return streamValue;
}
示例10: OnWriteHeaderContents
protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion)
{
writer.WriteStartElement("ID");
//writer.WriteString("{id}");
writer.WriteString("1408");
writer.WriteEndElement();
writer.WriteStartElement("MDP");
//writer.WriteString("{mdp}");
writer.WriteString("fophjkl32");
writer.WriteEndElement();
}
示例11: OnWriteHeaderContents
protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion)
{
if (this.address != null)
{
writer.WriteStartElement("netdx", "Address", "http://schemas.microsoft.com/2008/04/netduplex");
writer.WriteString(this.address);
writer.WriteEndElement();
}
writer.WriteStartElement("netdx", "SessionId", "http://schemas.microsoft.com/2008/04/netduplex");
writer.WriteString(this.sessionId);
writer.WriteEndElement();
}
示例12: WriteContentsTo
internal override void WriteContentsTo(XmlDictionaryWriter writer)
{
if (writer == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer");
writer.WriteStartElement(XD.XmlSignatureDictionary.Prefix.Value, XD.XmlSignatureDictionary.KeyInfo, XD.XmlSignatureDictionary.Namespace);
writer.WriteStartElement(XD.XmlSignatureDictionary.Prefix.Value, XD.XmlSignatureDictionary.X509Data, XD.XmlSignatureDictionary.Namespace);
for (int i = 0; i < certificateCollection.Count; ++i)
{
writer.WriteElementString(XD.XmlSignatureDictionary.X509Certificate, XD.XmlSignatureDictionary.Namespace, Convert.ToBase64String(certificateCollection[i].RawData));
}
writer.WriteEndElement();
writer.WriteEndElement();
}
示例13: WriteContentsTo
internal override void WriteContentsTo(XmlDictionaryWriter writer)
{
if (writer == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer");
writer.WriteStartElement(XD.XmlSignatureDictionary.Prefix.Value, XD.XmlSignatureDictionary.KeyInfo, XD.XmlSignatureDictionary.Namespace);
writer.WriteStartElement(XD.XmlSignatureDictionary.Prefix.Value, XD.XmlSignatureDictionary.RsaKeyValue, XD.XmlSignatureDictionary.Namespace);
RSA rsa = (RSA)this.IdentityClaim.Resource;
RSAParameters parameters = rsa.ExportParameters(false);
writer.WriteElementString(XD.XmlSignatureDictionary.Prefix.Value, XD.XmlSignatureDictionary.Modulus, XD.XmlSignatureDictionary.Namespace, Convert.ToBase64String(parameters.Modulus));
writer.WriteElementString(XD.XmlSignatureDictionary.Prefix.Value, XD.XmlSignatureDictionary.Exponent, XD.XmlSignatureDictionary.Namespace, Convert.ToBase64String(parameters.Exponent));
writer.WriteEndElement();
writer.WriteEndElement();
}
示例14: WriteHeader
private void WriteHeader(XmlDictionaryWriter writer)
{
writer.WriteStartElement("wsse", "UsernameToken", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
writer.WriteXmlnsAttribute("wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
writer.WriteStartElement("wsse", "Username", null);
writer.WriteString(SystemUser);
writer.WriteEndElement();//End Username
writer.WriteStartElement("wsse", "Password", null);
writer.WriteAttributeString("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");
writer.WriteString(SystemPassword);
writer.WriteEndElement();//End Password
writer.WriteEndElement();//End UsernameToken
writer.Flush();
}
示例15: OnWriteBodyContents
/// <summary>Called when the message body is written to an XML file.</summary>
/// <param name="writer">
/// An <see cref="XmlDictionaryWriter"/> that is used to write this
/// message body to an XML file.
/// </param>
protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
{
WebUtil.CheckArgumentNull(writer, "writer");
try
{
writer.WriteStartElement(XmlConstants.WcfBinaryElementName);
using (XmlWriterStream stream = new XmlWriterStream(writer))
{
this.writerAction(stream);
}
writer.WriteEndElement();
}
finally
{
if (this.service != null)
{
HttpContextServiceHost host = this.service.OperationContext.RequestMessage.HttpContextServiceHost;
this.service.DisposeDataSource();
if (host != null)
{
if (host.ErrorFound)
{
var ctx = System.ServiceModel.OperationContext.Current;
if (ctx != null)
{
ctx.Channel.Abort();
}
}
}
}
}
}