本文整理汇总了C#中System.Xml.XmlDictionaryWriter.WriteStartAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryWriter.WriteStartAttribute方法的具体用法?C# XmlDictionaryWriter.WriteStartAttribute怎么用?C# XmlDictionaryWriter.WriteStartAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryWriter
的用法示例。
在下文中一共展示了XmlDictionaryWriter.WriteStartAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
}
示例2: WriteTo
public void WriteTo(XmlDictionaryWriter writer, string prefix, XmlDictionaryString localName, XmlDictionaryString ns, XmlDictionaryString valueTypeLocalName, XmlDictionaryString valueTypeNs)
{
writer.WriteStartElement(prefix, localName, ns);
writer.WriteStartAttribute(valueTypeLocalName, valueTypeNs);
if (valueTypeUriDictionaryString != null)
writer.WriteString(valueTypeUriDictionaryString);
else
writer.WriteString(valueTypeUri);
writer.WriteEndAttribute();
writer.WriteStartAttribute(XD.SecurityJan2004Dictionary.EncodingType, null);
writer.WriteString(XD.SecurityJan2004Dictionary.EncodingTypeValueBase64Binary);
writer.WriteEndAttribute();
writer.WriteBase64(this.negotiationData, 0, this.negotiationData.Length);
writer.WriteEndElement();
}
示例3: OnWriteStartHeader
protected override void OnWriteStartHeader(XmlDictionaryWriter writer, MessageVersion messageVersion)
{
writer.WriteStartElement(this.Name, this.Namespace);
writer.WriteXmlnsAttribute(null, _notUnderstoodNs);
writer.WriteStartAttribute(Message12Strings.QName);
writer.WriteQualifiedName(_notUnderstoodName, _notUnderstoodNs);
writer.WriteEndAttribute();
}
示例4: OnWriteAddressHeaderContents
protected override void OnWriteAddressHeaderContents(XmlDictionaryWriter writer)
{
if (this.protocol != ControlProtocol.None)
{
writer.WriteStartAttribute(XD.DotNetAtomicTransactionExternalDictionary.Protocol, XD.DotNetAtomicTransactionExternalDictionary.Namespace);
writer.WriteValue((int) this.protocol);
writer.WriteEndAttribute();
}
writer.WriteValue(this.enlistment);
}
示例5: WriteTo
public void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager)
{
writer.WriteStartElement(this.prefix, this.elementName, dictionaryManager.XmlSignatureDictionary.Namespace);
writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
if (this.algorithmDictionaryString != null)
{
writer.WriteString(this.algorithmDictionaryString);
}
else
{
writer.WriteString(this.algorithm);
}
writer.WriteEndAttribute();
writer.WriteEndElement();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:ElementWithAlgorithmAttribute.cs
示例6: WriteXml
public virtual void WriteXml(XmlDictionaryWriter writer, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer)
{
this.CheckObjectValidity();
if (writer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("writer"));
}
if (samlSerializer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSerializer"));
}
SamlDictionary samlDictionary = samlSerializer.DictionaryManager.SamlDictionary;
writer.WriteStartElement(samlDictionary.PreferredPrefix.Value, samlDictionary.Action, samlDictionary.Namespace);
if (this.ns != null)
{
writer.WriteStartAttribute(samlDictionary.ActionNamespaceAttribute, null);
writer.WriteString(this.ns);
writer.WriteEndAttribute();
}
writer.WriteString(this.action);
writer.WriteEndElement();
}
示例7: WriteTo
public override void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager)
{
XmlDictionaryString localName = this.isCanonicalizationMethod ? dictionaryManager.XmlSignatureDictionary.CanonicalizationMethod : dictionaryManager.XmlSignatureDictionary.Transform;
XmlDictionaryString str2 = this.includeComments ? dictionaryManager.SecurityAlgorithmDictionary.ExclusiveC14nWithComments : dictionaryManager.SecurityAlgorithmDictionary.ExclusiveC14n;
writer.WriteStartElement(this.prefix, localName, dictionaryManager.XmlSignatureDictionary.Namespace);
writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
if (str2 != null)
{
writer.WriteString(str2);
}
else
{
writer.WriteString(str2.Value);
}
writer.WriteEndAttribute();
if (this.InclusiveNamespacesPrefixList != null)
{
writer.WriteStartElement(this.inclusiveListElementPrefix, dictionaryManager.ExclusiveC14NDictionary.InclusiveNamespaces, dictionaryManager.ExclusiveC14NDictionary.Namespace);
writer.WriteAttributeString(dictionaryManager.ExclusiveC14NDictionary.PrefixList, null, this.InclusiveNamespacesPrefixList);
writer.WriteEndElement();
}
writer.WriteEndElement();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:ExclusiveCanonicalizationTransform.cs
示例8: WriteTo
public void WriteTo(XmlDictionaryWriter writer)
{
writer.WriteStartElement("e", ElementName, System.ServiceModel.XD.XmlEncryptionDictionary.Namespace);
if (this.algorithmDictionaryString != null)
{
writer.WriteStartAttribute(System.ServiceModel.XD.XmlSignatureDictionary.Algorithm, null);
writer.WriteString(this.algorithmDictionaryString);
writer.WriteEndAttribute();
}
else
{
writer.WriteAttributeString(System.ServiceModel.XD.XmlSignatureDictionary.Algorithm, null, this.algorithm);
}
if (this.algorithm == System.ServiceModel.XD.SecurityAlgorithmDictionary.RsaOaepKeyWrap.Value)
{
writer.WriteStartElement("", System.ServiceModel.XD.XmlSignatureDictionary.DigestMethod, System.ServiceModel.XD.XmlSignatureDictionary.Namespace);
writer.WriteStartAttribute(System.ServiceModel.XD.XmlSignatureDictionary.Algorithm, null);
writer.WriteString(System.ServiceModel.XD.SecurityAlgorithmDictionary.Sha1Digest);
writer.WriteEndAttribute();
writer.WriteEndElement();
}
writer.WriteEndElement();
}
示例9: WriteXml
public virtual void WriteXml(XmlDictionaryWriter writer, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer)
{
this.CheckObjectValidity();
if (writer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("writer"));
}
if (samlSerializer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSerializer"));
}
SamlDictionary samlDictionary = samlSerializer.DictionaryManager.SamlDictionary;
writer.WriteStartElement(samlDictionary.PreferredPrefix.Value, samlDictionary.Attribute, samlDictionary.Namespace);
writer.WriteStartAttribute(samlDictionary.AttributeName, null);
writer.WriteString(this.name);
writer.WriteEndAttribute();
writer.WriteStartAttribute(samlDictionary.AttributeNamespace, null);
writer.WriteString(this.nameSpace);
writer.WriteEndAttribute();
for (int i = 0; i < this.attributeValues.Count; i++)
{
if (this.attributeValues[i] == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLAttributeValueCannotBeNull"));
}
writer.WriteElementString(samlDictionary.PreferredPrefix.Value, samlDictionary.AttributeValue, samlDictionary.Namespace, this.attributeValues[i]);
}
writer.WriteEndElement();
}
示例10: WriteTo
public override void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager)
{
string prefix = XmlSignatureStrings.Prefix;
XmlDictionaryString ns = dictionaryManager.XmlSignatureDictionary.Namespace;
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.SignedInfo, ns);
if (this.Id != null)
{
writer.WriteAttributeString(dictionaryManager.UtilityDictionary.IdAttribute, null, this.Id);
}
WriteCanonicalizationMethod(writer, dictionaryManager);
WriteSignatureMethod(writer, dictionaryManager);
for (int i = 0; i < this.count; i++)
{
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.Reference, ns);
writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.URI, null);
writer.WriteString("#");
writer.WriteString(this.references[i].id);
writer.WriteEndAttribute();
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.Transforms, ns);
if (this.addEnvelopedSignatureTransform)
{
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.Transform, ns);
writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
writer.WriteString(dictionaryManager.XmlSignatureDictionary.EnvelopedSignature);
writer.WriteEndAttribute();
writer.WriteEndElement(); // Transform
}
if (this.references[i].useStrTransform)
{
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.Transform, ns);
writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
writer.WriteString(SecurityAlgorithms.StrTransform);
writer.WriteEndAttribute();
writer.WriteStartElement(XmlSignatureStrings.SecurityJan2004Prefix, XmlSignatureStrings.TransformationParameters, XmlSignatureStrings.SecurityJan2004Namespace); //<wsse:TransformationParameters>
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.CanonicalizationMethod, ns);
writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
writer.WriteString(dictionaryManager.SecurityAlgorithmDictionary.ExclusiveC14n);
writer.WriteEndAttribute();
writer.WriteEndElement(); //CanonicalizationMethod
writer.WriteEndElement(); // TransformationParameters
writer.WriteEndElement(); // Transform
}
else
{
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.Transform, ns);
writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
writer.WriteString(dictionaryManager.SecurityAlgorithmDictionary.ExclusiveC14n);
writer.WriteEndAttribute();
writer.WriteEndElement(); // Transform
}
writer.WriteEndElement(); // Transforms
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.DigestMethod, ns);
writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
if (this.digestMethodDictionaryString != null)
{
writer.WriteString(this.digestMethodDictionaryString);
}
else
{
writer.WriteString(this.digestMethod);
}
writer.WriteEndAttribute();
writer.WriteEndElement(); // DigestMethod
byte[] digest = this.references[i].digest;
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.DigestValue, ns);
writer.WriteBase64(digest, 0, digest.Length);
writer.WriteEndElement(); // DigestValue
writer.WriteEndElement(); // Reference
}
writer.WriteEndElement(); // SignedInfo
}
示例11: WriteXml
public virtual void WriteXml(XmlDictionaryWriter writer, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer)
{
CheckObjectValidity();
if (writer == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer");
if (samlSerializer == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSerializer"));
#pragma warning suppress 56506 // samlSerializer.DictionaryManager is never null.
SamlDictionary dictionary = samlSerializer.DictionaryManager.SamlDictionary;
try
{
writer.WriteStartElement(dictionary.PreferredPrefix.Value, dictionary.Assertion, dictionary.Namespace);
writer.WriteStartAttribute(dictionary.MajorVersion, null);
writer.WriteValue(SamlConstants.MajorVersionValue);
writer.WriteEndAttribute();
writer.WriteStartAttribute(dictionary.MinorVersion, null);
writer.WriteValue(SamlConstants.MinorVersionValue);
writer.WriteEndAttribute();
writer.WriteStartAttribute(dictionary.AssertionId, null);
writer.WriteString(this.assertionId);
writer.WriteEndAttribute();
writer.WriteStartAttribute(dictionary.Issuer, null);
writer.WriteString(this.issuer);
writer.WriteEndAttribute();
writer.WriteStartAttribute(dictionary.IssueInstant, null);
writer.WriteString(this.issueInstant.ToString(SamlConstants.GeneratedDateTimeFormat, CultureInfo.InvariantCulture));
writer.WriteEndAttribute();
// Write out conditions
if (this.conditions != null)
{
this.conditions.WriteXml(writer, samlSerializer, keyInfoSerializer);
}
// Write out advice if there is one
if (this.advice != null)
{
this.advice.WriteXml(writer, samlSerializer, keyInfoSerializer);
}
for (int i = 0; i < this.statements.Count; i++)
{
this.statements[i].WriteXml(writer, samlSerializer, keyInfoSerializer);
}
writer.WriteEndElement();
}
catch (Exception e)
{
// Always immediately rethrow fatal exceptions.
if (Fx.IsFatal(e)) throw;
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SAMLTokenNotSerialized), e));
}
}
示例12: WriteXml
public virtual void WriteXml(XmlDictionaryWriter writer, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer)
{
if (writer == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("writer"));
if (samlSerializer == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSerializer"));
#pragma warning suppress 56506 // samlSerializer.DictionaryManager is never null.
SamlDictionary dictionary = samlSerializer.DictionaryManager.SamlDictionary;
writer.WriteStartElement(dictionary.PreferredPrefix.Value, dictionary.Conditions, dictionary.Namespace);
if (this.notBefore != SecurityUtils.MinUtcDateTime)
{
writer.WriteStartAttribute(dictionary.NotBefore, null);
writer.WriteString(this.notBefore.ToString(SamlConstants.GeneratedDateTimeFormat, DateTimeFormatInfo.InvariantInfo));
writer.WriteEndAttribute();
}
if (this.notOnOrAfter != SecurityUtils.MaxUtcDateTime)
{
writer.WriteStartAttribute(dictionary.NotOnOrAfter, null);
writer.WriteString(this.notOnOrAfter.ToString(SamlConstants.GeneratedDateTimeFormat, DateTimeFormatInfo.InvariantInfo));
writer.WriteEndAttribute();
}
for (int i = 0; i < this.conditions.Count; i++)
{
this.conditions[i].WriteXml(writer, samlSerializer, keyInfoSerializer);
}
writer.WriteEndElement();
}
示例13: WriteAttributeStringAsUniqueId
static public void WriteAttributeStringAsUniqueId(XmlDictionaryWriter writer, string prefix, XmlDictionaryString localName, XmlDictionaryString ns, UniqueId id)
{
writer.WriteStartAttribute(prefix, localName, ns);
writer.WriteValue(id);
writer.WriteEndAttribute();
}
示例14: WriteStartObject
public override void WriteStartObject (
XmlDictionaryWriter writer, object graph)
{
Type rootType = type;
if (root_name.Value == "")
throw new InvalidDataContractException ("Type '" + type.ToString () +
"' cannot have a DataContract attribute Name set to null or empty string.");
if (graph == null) {
if (names_filled)
writer.WriteStartElement (root_name.Value, root_ns.Value);
else
writer.WriteStartElement (root_name, root_ns);
writer.WriteAttributeString ("i", "nil", XmlSchema.InstanceNamespace, "true");
return;
}
QName instName = null;
QName root_qname = known_types.GetQName (rootType);
QName graph_qname = known_types.GetQName (graph.GetType ());
known_types.Add (graph.GetType ());
if (names_filled)
writer.WriteStartElement (root_name.Value, root_ns.Value);
else
writer.WriteStartElement (root_name, root_ns);
if (root_ns.Value != root_qname.Namespace)
if (root_qname.Namespace != KnownTypeCollection.MSSimpleNamespace)
writer.WriteXmlnsAttribute (null, root_qname.Namespace);
if (root_qname == graph_qname) {
if (root_qname.Namespace != KnownTypeCollection.MSSimpleNamespace &&
!rootType.IsEnum)
//FIXME: Hack, when should the "i:type" be written?
//Not used in case of enums
writer.WriteXmlnsAttribute ("i", XmlSchema.InstanceNamespace);
return;
}
/* Different names */
known_types.Add (rootType);
instName = KnownTypeCollection.GetPredefinedTypeName (graph.GetType ());
if (instName == QName.Empty)
/* Not a primitive type */
instName = graph_qname;
else
/* FIXME: Hack, .. see test WriteObject7 () */
instName = new QName (instName.Name, XmlSchema.Namespace);
// output xsi:type as rootType is not equivalent to the graph's type.
writer.WriteStartAttribute ("i", "type", XmlSchema.InstanceNamespace);
writer.WriteQualifiedName (instName.Name, instName.Namespace);
writer.WriteEndAttribute ();
}
示例15: WriteXml
public virtual void WriteXml(XmlDictionaryWriter writer, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer)
{
this.CheckObjectValidity();
if (writer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer");
}
if (samlSerializer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSerializer"));
}
SamlDictionary samlDictionary = samlSerializer.DictionaryManager.SamlDictionary;
try
{
writer.WriteStartElement(samlDictionary.PreferredPrefix.Value, samlDictionary.Assertion, samlDictionary.Namespace);
writer.WriteStartAttribute(samlDictionary.MajorVersion, null);
writer.WriteValue(SamlConstants.MajorVersionValue);
writer.WriteEndAttribute();
writer.WriteStartAttribute(samlDictionary.MinorVersion, null);
writer.WriteValue(SamlConstants.MinorVersionValue);
writer.WriteEndAttribute();
writer.WriteStartAttribute(samlDictionary.AssertionId, null);
writer.WriteString(this.assertionId);
writer.WriteEndAttribute();
writer.WriteStartAttribute(samlDictionary.Issuer, null);
writer.WriteString(this.issuer);
writer.WriteEndAttribute();
writer.WriteStartAttribute(samlDictionary.IssueInstant, null);
writer.WriteString(this.issueInstant.ToString("yyyy-MM-ddTHH:mm:ss.fffZ", CultureInfo.InvariantCulture));
writer.WriteEndAttribute();
if (this.conditions != null)
{
this.conditions.WriteXml(writer, samlSerializer, keyInfoSerializer);
}
if (this.advice != null)
{
this.advice.WriteXml(writer, samlSerializer, keyInfoSerializer);
}
for (int i = 0; i < this.statements.Count; i++)
{
this.statements[i].WriteXml(writer, samlSerializer, keyInfoSerializer);
}
writer.WriteEndElement();
}
catch (Exception exception)
{
if (Fx.IsFatal(exception))
{
throw;
}
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.IdentityModel.SR.GetString("SAMLTokenNotSerialized"), exception));
}
}