当前位置: 首页>>代码示例>>C#>>正文


C# XmlDictionaryWriter.WriteAttributeString方法代码示例

本文整理汇总了C#中System.Xml.XmlDictionaryWriter.WriteAttributeString方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryWriter.WriteAttributeString方法的具体用法?C# XmlDictionaryWriter.WriteAttributeString怎么用?C# XmlDictionaryWriter.WriteAttributeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlDictionaryWriter的用法示例。


在下文中一共展示了XmlDictionaryWriter.WriteAttributeString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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.mszzzz");

            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();
        }
开发者ID:Rijndaal,项目名称:midpoint,代码行数:25,代码来源:WsSecurityHeaders.cs

示例2: 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);
            }
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:28,代码来源:ServiceMetadataGenerator.cs

示例3: OnWriteHeaderContents

 protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion)
 {
     if (this.wsatInfo != null)
     {
         if (this.wsatInfo.Timeout != 0)
         {
             writer.WriteAttributeString(XD.CoordinationExternalDictionary.Expires, CoordinationNamespace, XmlConvert.ToString(this.wsatInfo.Timeout));
         }
         if (!string.IsNullOrEmpty(this.wsatInfo.Identifier))
         {
             writer.WriteAttributeString(XD.CoordinationExternalDictionary.Identifier, CoordinationNamespace, this.wsatInfo.Identifier);
         }
     }
     WritePropagationTokenElement(writer, this.propagationToken);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:OleTxTransactionHeader.cs

示例4: 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();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:XmlEncApr2001.cs

示例5: WriteAdditionalAttributes

 protected override void WriteAdditionalAttributes(XmlDictionaryWriter writer)
 {
     if (this.recipient != null)
     {
         writer.WriteAttributeString(RecipientAttribute, null, this.recipient);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:EncryptedKey.cs

示例6: OnWriteBodyContents

            protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
            {
                writer.WriteStartElement("root");
                writer.WriteAttributeString("type", "object");

                writer.WriteStartElement("message");
                writer.WriteAttributeString("type", "string");
                writer.WriteString(this.exception.Message);
                writer.WriteEndElement();

                writer.WriteEndElement();
            }
开发者ID:keily,项目名称:DotNetBasicStudy,代码行数:12,代码来源:RestErrorHandler.cs

示例7: OnWriteHeaderContents

 protected override void OnWriteHeaderContents(
     XmlDictionaryWriter writer,
     MessageVersion messageVersion)
 {
     if (null == writer) {
         throw new ArgumentNullException("writer");
     }
     writer.WriteStartElement("Property", this.Namespace);
     writer.WriteAttributeString("name", null, "instanceId");
     writer.WriteValue(Value);
     writer.WriteEndElement();
 }
开发者ID:Predica,项目名称:FimClient,代码行数:12,代码来源:ContextMessageHeader.cs

示例8: WriteTo

 public override void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager)
 {
     string prefix = "";
     XmlDictionaryString namespaceUri = dictionaryManager.XmlSignatureDictionary.Namespace;
     writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.SignedInfo, namespaceUri);
     if (base.Id != null)
     {
         writer.WriteAttributeString(dictionaryManager.UtilityDictionary.IdAttribute, null, base.Id);
     }
     base.WriteCanonicalizationMethod(writer, dictionaryManager);
     base.WriteSignatureMethod(writer, dictionaryManager);
     for (int i = 0; i < this.count; i++)
     {
         writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.Reference, namespaceUri);
         writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.URI, null);
         writer.WriteString("#");
         writer.WriteString(this.references[i].id);
         writer.WriteEndAttribute();
         writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.Transforms, namespaceUri);
         if (this.addEnvelopedSignatureTransform)
         {
             writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.Transform, namespaceUri);
             writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
             writer.WriteString(dictionaryManager.XmlSignatureDictionary.EnvelopedSignature);
             writer.WriteEndAttribute();
             writer.WriteEndElement();
         }
         writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.Transform, namespaceUri);
         writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
         writer.WriteString(dictionaryManager.SecurityAlgorithmDictionary.ExclusiveC14n);
         writer.WriteEndAttribute();
         writer.WriteEndElement();
         writer.WriteEndElement();
         writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.DigestMethod, namespaceUri);
         writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
         if (this.digestMethodDictionaryString != null)
         {
             writer.WriteString(this.digestMethodDictionaryString);
         }
         else
         {
             writer.WriteString(this.digestMethod);
         }
         writer.WriteEndAttribute();
         writer.WriteEndElement();
         byte[] digest = this.references[i].digest;
         writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.DigestValue, namespaceUri);
         writer.WriteBase64(digest, 0, digest.Length);
         writer.WriteEndElement();
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:53,代码来源:PreDigestedSignedInfo.cs

示例9: OnWriteBodyContents

            protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
            {
                writer.WriteStartElement("root");
                writer.WriteAttributeString("type", "object");

                writer.WriteStartElement("ErrorMessage");
                writer.WriteAttributeString("type", "string");
                writer.WriteString(this.validationException.ValidationResult.ErrorMessage);
                writer.WriteEndElement();

                writer.WriteStartElement("MemberNames");
                writer.WriteAttributeString("type", "array");
                foreach (var member in this.validationException.ValidationResult.MemberNames)
                {
                    writer.WriteStartElement("item");
                    writer.WriteAttributeString("type", "string");
                    writer.WriteString(member);
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();

                writer.WriteEndElement();
            }
开发者ID:GusLab,项目名称:WCFSamples,代码行数:23,代码来源:ValidationAwareErrorHandler.cs

示例10: 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();
 }
开发者ID:Qwatcha,项目名称:payu-mea-code-examples-rpp-dotnet,代码行数:14,代码来源:SecurityHeader.cs

示例11: WriteTo

 public void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager)
 {
     writer.WriteStartElement(this.prefix, dictionaryManager.XmlSignatureDictionary.Signature, dictionaryManager.XmlSignatureDictionary.Namespace);
     if (this.id != null)
     {
         writer.WriteAttributeString(dictionaryManager.UtilityDictionary.IdAttribute, null, this.id);
     }
     this.signedInfo.WriteTo(writer, dictionaryManager);
     this.signatureValueElement.WriteTo(writer, dictionaryManager);
     if (this.keyIdentifier != null)
     {
         this.signedXml.SecurityTokenSerializer.WriteKeyIdentifier(writer, this.keyIdentifier);
     }
     writer.WriteEndElement();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:Signature.cs

示例12: OnWriteBodyContents

		protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
		{
			writer.WriteStartElement("BaseObjectSearchRequest", "http://schemas.microsoft.com/2006/11/IdentityManagement/DirectoryAccess");
			writer.WriteAttributeString("Dialect", "http://schemas.microsoft.com/2008/1/ActiveDirectory/Dialect/XPath-Level-1");
			base.OnWriteBodyContents(writer);
			string str = writer.LookupPrefix("http://schemas.microsoft.com/2008/1/ActiveDirectory/Data");
			string str1 = writer.LookupPrefix("http://schemas.microsoft.com/2008/1/ActiveDirectory");
			if (this._attributeList != null)
			{
				XmlUtility.SerializeAttributeList(writer, "AttributeType", "http://schemas.microsoft.com/2006/11/IdentityManagement/DirectoryAccess", str1, str, this._attributeList);
			}
			if (this._controls != null)
			{
				DirectoryControlSerializer.Serialize(writer, this._controls);
			}
			writer.WriteEndElement();
		}
开发者ID:nickchal,项目名称:pash,代码行数:17,代码来源:ADGetRequestMsg.cs

示例13: OnWriteBodyContents

		protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
		{
			writer.WriteStartElement("AddRequest", "http://schemas.microsoft.com/2006/11/IdentityManagement/DirectoryAccess");
			writer.WriteAttributeString("Dialect", "http://schemas.microsoft.com/2008/1/ActiveDirectory/Dialect/XPath-Level-1");
			if (this._attributes != null)
			{
				foreach (DirectoryAttribute _attribute in this._attributes)
				{
					AttributeTypeAndValueSerializer.Serialize(writer, _attribute);
				}
			}
			AttributeTypeAndValueSerializer.Serialize(writer, "http://schemas.microsoft.com/2008/1/ActiveDirectory", "relativeDistinguishedName", this._relativeDistinguishedName);
			AttributeTypeAndValueSerializer.Serialize(writer, "http://schemas.microsoft.com/2008/1/ActiveDirectory", "container-hierarchy-parent", this._parentContainer);
			if (this._controls != null)
			{
				DirectoryControlSerializer.Serialize(writer, this._controls);
			}
			writer.WriteEndElement();
		}
开发者ID:nickchal,项目名称:pash,代码行数:19,代码来源:ADCreateRequestMsg.cs

示例14: JsonValueToJXML

        public static void JsonValueToJXML(XmlDictionaryWriter jsonWriter, JsonValue jsonValue)
        {
            if (jsonWriter == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("jsonWriter");
            }

            jsonWriter.WriteStartElement(RootElementName);
            if (jsonValue == null)
            {
                jsonWriter.WriteAttributeString(TypeAttributeName, NullAttributeValue);
            }
            else
            {
                jsonValue.Save(jsonWriter);
            }

            jsonWriter.WriteEndElement();
        }
开发者ID:nuxleus,项目名称:WCFWeb,代码行数:19,代码来源:JXmlToJsonValueConverter.cs

示例15: WriteKeyIdentifierClauseCore

            public override void WriteKeyIdentifierClauseCore(XmlDictionaryWriter writer, SecurityKeyIdentifierClause keyIdentifierClause)
            {
                for (int i = 0; i < this.StrEntries.Count; ++i)
                {
                    if (this.StrEntries[i].SupportsCore(keyIdentifierClause))
                    {
                        writer.WriteStartElement(XD.SecurityJan2004Dictionary.Prefix.Value, XD.SecurityJan2004Dictionary.SecurityTokenReference, XD.SecurityJan2004Dictionary.Namespace);

                        string tokenTypeUri = this.GetTokenTypeUri(this.StrEntries[i], keyIdentifierClause);
                        if (tokenTypeUri != null)
                        {
                            writer.WriteAttributeString(XD.SecurityXXX2005Dictionary.Prefix.Value, XD.SecurityXXX2005Dictionary.TokenTypeAttribute, XD.SecurityXXX2005Dictionary.Namespace, tokenTypeUri);
                        }

                        this.StrEntries[i].WriteContent(writer, keyIdentifierClause);
                        writer.WriteEndElement();
                        return;
                    }
                }
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.StandardsManagerCannotWriteObject, keyIdentifierClause.GetType())));
            }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:21,代码来源:WSSecurityXXX2005.cs


注:本文中的System.Xml.XmlDictionaryWriter.WriteAttributeString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。