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


C# XmlDictionaryWriter.WriteString方法代码示例

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


在下文中一共展示了XmlDictionaryWriter.WriteString方法的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: 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();
        }
开发者ID:mugstrasbourg,项目名称:w10-strasbourgtransport,代码行数:12,代码来源:CtsMessageHeader.cs

示例3: 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();
 }
开发者ID:akalafrancis,项目名称:sipsorcery-mono,代码行数:12,代码来源:DuplexHeader.cs

示例4: 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

示例5: 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();
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:15,代码来源:BinaryNegotiation.cs

示例6: 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

示例7: 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

示例8: WriteEndObject

 public override void WriteEndObject(XmlDictionaryWriter writer)
 {
     if (!skipName)
     {
         writer.WriteString("\n\t");
         writer.WriteEndElement();
     }
 }
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:8,代码来源:DiffSerializer.cs

示例9: OnBodyToString

 protected override void OnBodyToString(XmlDictionaryWriter writer)
 {
     if (this.bodyWriter.IsBuffered)
     {
         this.bodyWriter.WriteBodyContents(writer);
     }
     else
     {
         writer.WriteString(System.ServiceModel.SR.GetString("MessageBodyIsStream"));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:BodyWriterMessage.cs

示例10: 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

示例11: WriteTo

 public void WriteTo(XmlDictionaryWriter writer)
 {
     writer.WriteStartElement(this.coordinationStrings.Prefix, this.coordinationXmlDictionaryStrings.Register, this.coordinationXmlDictionaryStrings.Namespace);
     XmlDictionaryString str = WSAtomicTransactionStrings.ProtocolToWellKnownName(this.Protocol, this.protocolVersion);
     writer.WriteStartElement(this.coordinationXmlDictionaryStrings.Protocol, this.coordinationXmlDictionaryStrings.Namespace);
     writer.WriteString(str);
     writer.WriteEndElement();
     this.ParticipantProtocolService.WriteTo(MessagingVersionHelper.AddressingVersion(this.protocolVersion), writer, this.coordinationXmlDictionaryStrings.ParticipantProtocolService, this.coordinationXmlDictionaryStrings.Namespace);
     if (this.Loopback != Guid.Empty)
     {
         writer.WriteStartElement("mstx", XD.DotNetAtomicTransactionExternalDictionary.Loopback, XD.DotNetAtomicTransactionExternalDictionary.Namespace);
         writer.WriteValue(this.Loopback);
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:Register.cs

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

示例13: Serialize

		internal static void Serialize(MessageDictionary messageDictionary, XmlDictionaryWriter writer) {
			Requires.NotNull(messageDictionary, "messageDictionary");
			Requires.NotNull(writer, "writer");

			writer.WriteStartElement("root");
			writer.WriteAttributeString("type", "object");
			foreach (var pair in messageDictionary) {
				bool include = false;
				string type = "string";
				MessagePart partDescription;
				if (messageDictionary.Description.Mapping.TryGetValue(pair.Key, out partDescription)) {
					Contract.Assume(partDescription != null);
					if (partDescription.IsRequired || partDescription.IsNondefaultValueSet(messageDictionary.Message)) {
						include = true;
						Type formattingType = partDescription.PreferredFormattingType;
						if (IsNumeric(formattingType)) {
							type = "number";
						} else if (formattingType.IsAssignableFrom(typeof(bool))) {
							type = "boolean";
						}
					}
				} else {
					// This is extra data.  We always write it out.
					include = true;
				}

				if (include) {
					writer.WriteStartElement(pair.Key);
					writer.WriteAttributeString("type", type);
					writer.WriteString(pair.Value);
					writer.WriteEndElement();
				}
			}

			writer.WriteEndElement();
		}
开发者ID:saharM,项目名称:dotnetopenid,代码行数:36,代码来源:MessageSerializer.cs

示例14: 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));
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:60,代码来源:SamlAssertion.cs

示例15: WriteTo

            public void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager)
            {
                bool isEmptyElement;
                if (writer == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("writer"));
                }
                if (!this.MoveToFirst())
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.IdentityModel.SR.GetString("XmlTokenBufferIsEmpty")));
                }
                int num = 0;
                int num2 = -1;
                bool flag = true;
            Label_0040:
                switch (this.NodeType)
                {
                    case XmlNodeType.Element:
                        isEmptyElement = this.IsEmptyElement;
                        num++;
                        if (flag)
                        {
                            if (this.excludedElementDepth.HasValue)
                            {
                                int? excludedElementDepth = this.excludedElementDepth;
                                int num3 = num - 1;
                                if (!((excludedElementDepth.GetValueOrDefault() == num3) && excludedElementDepth.HasValue))
                                {
                                    break;
                                }
                            }
                            if ((this.LocalName == this.excludedElement) && (this.NamespaceUri == this.excludedElementNamespace))
                            {
                                flag = false;
                                num2 = num;
                            }
                        }
                        break;

                    case XmlNodeType.Text:
                        if (flag)
                        {
                            writer.WriteString(this.Value);
                        }
                        goto Label_01AD;

                    case XmlNodeType.CDATA:
                        if (flag)
                        {
                            writer.WriteCData(this.Value);
                        }
                        goto Label_01AD;

                    case XmlNodeType.Comment:
                        if (flag)
                        {
                            writer.WriteComment(this.Value);
                        }
                        goto Label_01AD;

                    case XmlNodeType.Whitespace:
                    case XmlNodeType.SignificantWhitespace:
                        if (flag)
                        {
                            writer.WriteWhitespace(this.Value);
                        }
                        goto Label_01AD;

                    case XmlNodeType.EndElement:
                        goto Label_0152;

                    default:
                        goto Label_01AD;
                }
                if (flag)
                {
                    writer.WriteStartElement(this.Prefix, this.LocalName, this.NamespaceUri);
                }
                if (this.MoveToFirstAttribute())
                {
                    do
                    {
                        if (flag)
                        {
                            writer.WriteAttributeString(this.Prefix, this.LocalName, this.NamespaceUri, this.Value);
                        }
                    }
                    while (this.MoveToNextAttribute());
                }
                if (!isEmptyElement)
                {
                    goto Label_01AD;
                }
            Label_0152:
                if (flag)
                {
                    writer.WriteEndElement();
                }
                else if (num2 == num)
                {
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:XmlTokenStream.cs


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