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


C# XmlWriter.WriteAttributeString方法代码示例

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


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

示例1: WriteTo

 // Methods
 internal virtual void WriteTo( XmlWriter xmlWriter )
 {
     xmlWriter.WriteStartElement( XmlDiff.Prefix, "descriptor", XmlDiff.NamespaceUri );
     xmlWriter.WriteAttributeString( "opid", _operationID.ToString() );
     xmlWriter.WriteAttributeString( "type", Type );
     xmlWriter.WriteEndElement();
 }
开发者ID:Podracer,项目名称:DAE-notepad,代码行数:8,代码来源:OperationDescriptor.cs

示例2: writeVertex

 public static void writeVertex(XmlWriter writer, Vector2D vert)
 {
     writer.WriteStartElement("vertex");
     writer.WriteAttributeString("x", vert.x.ToString());
     writer.WriteAttributeString("y", vert.y.ToString());
     writer.WriteEndElement();
 }
开发者ID:CodeMason,项目名称:LibGDX_DoomBuilder,代码行数:7,代码来源:MapWriter.cs

示例3: WriteResponseMessage

        public void WriteResponseMessage ( XmlWriter writer, string innerXml, NuxleusAsyncResult asyncResult ) {

            using (writer) {
                writer.WriteStartDocument();
                if (m_responseType == ResponseType.REDIRECT) {
                    writer.WriteProcessingInstruction("xml-stylesheet", "type='text/xsl' href='/service/transform/openid-redirect.xsl'");
                }
                writer.WriteStartElement("auth");
                writer.WriteAttributeString("xml:base", "http://dev.amp.fm/");
                writer.WriteAttributeString("status", m_status);
                if (m_responseType == ResponseType.REDIRECT) {
                    writer.WriteElementString("url", "http://dev.amp.fm/");
                }
                if (m_responseType == ResponseType.QUERY_RESPONSE && innerXml != null) {
                    writer.WriteStartElement("response");
                    writer.WriteRaw(innerXml);
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
                writer.WriteEndDocument();
            }

            asyncResult.CompleteCall();

        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:25,代码来源:Message.cs

示例4: TraverseDirectory

        private static void TraverseDirectory(XmlWriter writer, string path, StringBuilder textToShowinConsole)
        {
            bool inDirectories = true;
            string[] folderDirectories = Directory.GetDirectories(path);

            if (0 == folderDirectories.Length)
            {
                folderDirectories = Directory.GetFiles(path);
                inDirectories = false;
            }

            for (int i = 0; i < folderDirectories.Length; i++)
            {
                textToShowinConsole.AppendLine(folderDirectories[i]);
                if (inDirectories)
                {
                    writer.WriteStartElement("dir");
                    writer.WriteAttributeString("path", folderDirectories[i]);
                    TraverseDirectory(writer, folderDirectories[i], textToShowinConsole);
                    writer.WriteEndElement();
                }
                else
                {
                    writer.WriteStartElement("file");
                    writer.WriteAttributeString("filename", Path.GetFileName(folderDirectories[i]));
                    writer.WriteEndElement();
                }
            }
        }
开发者ID:viktorD1m1trov,项目名称:T-Academy,代码行数:29,代码来源:VeryLaggProgram.cs

示例5: WriteTo

		public void WriteTo(XmlWriter writer)
		{
			writer.WriteStartElement("Setting");
			writer.WriteAttributeString("Name", this.Name);
			writer.WriteAttributeString("Type", this.SerializedSettingType);
			writer.WriteAttributeString("Scope", this.Scope.ToString());
			
			if (!string.IsNullOrEmpty(description)) {
				writer.WriteAttributeString("Description", description);
			}
			if (generateDefaultValueInCode != GenerateDefaultValueInCodeDefault) {
				writer.WriteAttributeString("GenerateDefaultValueInCode", XmlConvert.ToString(generateDefaultValueInCode));
			}
			if (!string.IsNullOrEmpty(provider)) {
				writer.WriteAttributeString("Provider", provider);
			}
			if (scope == SettingScope.User) {
				writer.WriteAttributeString("Roaming", XmlConvert.ToString(roaming));
			}
			
			writer.WriteStartElement("Value");
			writer.WriteAttributeString("Profile", "(Default)");
			writer.WriteValue(SerializedValue);
			writer.WriteEndElement();
			
			writer.WriteEndElement(); // Setting
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:27,代码来源:SettingsEntry.cs

示例6: ToXml

 internal override void ToXml(XmlWriter writer, string element)
 {
     writer.WriteStartElement(element);
     writer.WriteAttributeString("xsi:type", "ChangesetVersionSpec");
     writer.WriteAttributeString("cs", Convert.ToString(changesetId));
     writer.WriteEndElement();
 }
开发者ID:Jeff-Lewis,项目名称:opentf,代码行数:7,代码来源:ChangesetVersionSpec.cs

示例7: Write

        /// <summary>
        /// Writes the section using an XML writer
        /// </summary>
        /// <param name="writer">XML writer to use</param>
        /// <param name="project">The project to generate .csproj for</param>
        /// <param name="context">Current .csproj generation context</param>
        public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context)
        {
            var csRoot = project.RootDirectory.GetChildDirectory("cs");
            if (csRoot != null)
            {
                var serviceReferencesRoot = csRoot.GetChildDirectory("Service References");
                if (serviceReferencesRoot != null)
                {
                    writer.WriteStartElement("ItemGroup");

                    writer.WriteStartElement("WCFMetadata");
                    writer.WriteAttributeString("Include", "Service References" + Path.DirectorySeparatorChar);
                    writer.WriteEndElement();

                    foreach (var child in serviceReferencesRoot.ChildDirectories)
                    {
                        writer.WriteStartElement("WCFMetadataStorage");
                        writer.WriteAttributeString("Include", "Service References\\" + child + Path.DirectorySeparatorChar);
                        writer.WriteEndElement();
                    }

                    writer.WriteEndElement();
                }
            }
        }
开发者ID:vigoo,项目名称:bari,代码行数:31,代码来源:WCFMetadataSection.cs

示例8: WriteXml

		internal override void WriteXml(XmlWriter writer)
		{
			if (base.IsSlot)
			{
                writer.WriteStartElement("Property", NodeQuery.XmlNamespace);
				writer.WriteAttributeString("name", base.PropertySlot.Name);
				writer.WriteEndElement();
			}
			else if (!IsValue)
			{
                writer.WriteStartElement("Property", NodeQuery.XmlNamespace);
				writer.WriteAttributeString("name", base.NodeAttribute.ToString());
				writer.WriteEndElement();
			}
			else
			{
				if (_value == null)
                    writer.WriteElementString("NullValue", NodeQuery.XmlNamespace, null);
				else if (_value is string)
					writer.WriteString((string)_value);
				else if (_value is int)
					writer.WriteString(XmlConvert.ToString((int)_value));
				else if (_value is decimal)
					writer.WriteString(XmlConvert.ToString((decimal)_value));
				if (_value is DateTime)
					writer.WriteString(XmlConvert.ToString((DateTime)_value, XmlDateTimeSerializationMode.Unspecified));
			}

		}
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:29,代码来源:Literal.cs

示例9: Write

        public static void Write(XmlWriter writer, Ticket pt)
        {
            var declarations = NamespaceDeclarations(pt);

            writer.WriteStartDocument();
            var prefix = declarations.LookupPrefix(Psf.PrintTicket.NamespaceName);
            writer.WriteStartElement(prefix, Psf.PrintTicket.LocalName, Psf.PrintTicket.NamespaceName);
            writer.WriteAttributeString("version", "1");

            foreach (var decl in declarations)
            {
                writer.WriteAttributeString("xmlns", decl.Prefix, null, decl.Uri.NamespaceName);
            }

            foreach (var f in pt.Features())
            {
                Write(writer, f);
            }

            foreach (var p in pt.Properties())
            {
                Write(writer, p);
            }

            foreach (var p in pt.Parameters())
            {
                Write(writer, p);
            }

            writer.WriteEndElement();
            writer.Flush();
        }
开发者ID:kei10in,项目名称:KipSharp,代码行数:32,代码来源:PrintSchemaWriter.cs

示例10: ToXml

        // Originally this class used the XML attributes to serialize itself
        // via an XmlSerializer, but that turns out not the work (see the comments
        // in EventWriter). So instead we have localized all the XML related code
        // in this one method. It turns out to be simpler to understand, too.
        public void ToXml(XmlWriter writer)
        {
            Contract.Requires(writer != null);

            writer.WriteStartElement("event");
            if (Stanza != null) writer.WriteAttributeString("stanza", Stanza);
            if (Unbroken) writer.WriteAttributeString("unbroken", "1");

            if (Data != null) WriteTextElement(writer, "data", Data);
            if (Source != null) WriteTextElement(writer, "source", Source);
            if (SourceType != null) WriteTextElement(writer, "sourcetype", SourceType);
            if (Index != null) WriteTextElement(writer, "index", Index);
            if (Host != null) WriteTextElement(writer, "host", Host);

            if (Time.HasValue)
            {
                double timestamp = (double)(Time.Value.Ticks - ticksSinceEpoch) / TimeSpan.TicksPerSecond;
                writer.WriteStartElement("time");
                writer.WriteString(timestamp.ToString());
                writer.WriteEndElement();
            }

            if (Done)
            {
                writer.WriteStartElement("done");
                writer.WriteEndElement();
            }

            writer.WriteEndElement();
        }
开发者ID:Netsuye,项目名称:Splunk-SDK,代码行数:34,代码来源:Event.cs

示例11: WriteValue

		protected override void WriteValue(XmlWriter writer, object value)
		{
			IDictionary dictionary = (IDictionary) value;
			foreach (object key in dictionary.Keys)
			{
				object target = dictionary[key];

				// any way to refactor code block?
				ReflectorTypeAttribute typeAttribute = ReflectorTypeAttribute.GetAttribute(target);
				if (typeAttribute == null)
				{
					writer.WriteStartElement(elementName);
					writer.WriteAttributeString(attribute.Key, key.ToString());
					writer.WriteString(target.ToString());
					writer.WriteEndElement();
				}
				else
				{
					writer.WriteStartElement(typeAttribute.Name);
					writer.WriteAttributeString(attribute.Key, key.ToString());

					XmlTypeSerialiser serialiser = (XmlTypeSerialiser) typeAttribute.CreateSerialiser(target.GetType());
					serialiser.WriteMembers(writer, target);

					writer.WriteEndElement();
				}
			}
		}
开发者ID:modulexcite,项目名称:NetReflector,代码行数:28,代码来源:XmlDictionarySerialiser.cs

示例12: WriteTo

		void WriteTo (XmlWriter writer)
		{
			writer.WriteStartElement (Node);
			if (NodeName != null)
				writer.WriteAttributeString (nameAttribute, NodeName);
			if (Expanded)
				writer.WriteAttributeString (expandedAttribute, bool.TrueString);
			if (Selected)
				writer.WriteAttributeString (selectedAttribute, bool.TrueString);

			if (Options != null) {
				foreach (var opt in Options) {
					writer.WriteStartElement ("Option");
					writer.WriteAttributeString ("id", opt.Key.ToString());
					writer.WriteAttributeString ("value", opt.Value.ToString ());
					writer.WriteEndElement (); // Option
				}
			}
			
			if (ChildrenState != null) { 
				foreach (NodeState ces in ChildrenState) {
					ces.WriteTo (writer);
				}
			}
			
			writer.WriteEndElement (); // NodeState
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:27,代码来源:NodeState.cs

示例13: GenerateXmlAttributes

        public override void GenerateXmlAttributes(XmlWriter writer) {
            base.GenerateXmlAttributes(writer);

            if(Label.IsNotWhiteSpace())
                writer.WriteAttributeString("label", Label);
            if(Align.HasValue)
                writer.WriteAttributeString("Align", Align.ToString());
            if(VAlign.HasValue)
                writer.WriteAttributeString("VAlign", VAlign.ToString());

            if(_fontAttr != null)
                _fontAttr.GenerateXmlAttributes(writer);

            if(LetterSpacing.HasValue)
                writer.WriteAttributeString("LetterSpacing", LetterSpacing.ToString());
            if(LeftMargin.HasValue)
                writer.WriteAttributeString("LeftMargin", LeftMargin.ToString());
            if(BgColor.HasValue)
                writer.WriteAttributeString("BgColor", BgColor.Value.ToHexString());
            if(BorderColor.HasValue)
                writer.WriteAttributeString("BorderColor", BorderColor.Value.ToHexString());
            if(Wrap.HasValue)
                writer.WriteAttributeString("Wrap", Wrap.GetHashCode().ToString());
            if(WrapWidth.HasValue)
                writer.WriteAttributeString("WrapWidth", WrapWidth.ToString());
            if(WrapHeight.HasValue)
                writer.WriteAttributeString("WrapHeight", WrapHeight.ToString());
        }
开发者ID:debop,项目名称:NFramework,代码行数:28,代码来源:TextAnnotation.cs

示例14: AddAuthors

        /// <summary>
        /// Add authors.
        /// </summary>
        /// <param name="writer">
        /// The writer.
        /// </param>
        private static void AddAuthors(XmlWriter writer)
        {
            writer.WriteStartElement("authors");

            foreach (MembershipUser user in Membership.GetAllUsers())
            {
                writer.WriteStartElement("author");

                writer.WriteAttributeString("id", user.UserName);
                writer.WriteAttributeString(
                    "date-created", user.CreationDate.ToString("yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture));
                writer.WriteAttributeString(
                    "date-modified", user.CreationDate.ToString("yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture));
                writer.WriteAttributeString("approved", "true");
                writer.WriteAttributeString("email", user.Email);

                writer.WriteStartElement("title");
                writer.WriteAttributeString("type", "text");
                writer.WriteCData(user.UserName);
                writer.WriteEndElement();

                writer.WriteEndElement();
            }

            writer.WriteEndElement();
        }
开发者ID:sagasu,项目名称:tddLegacy,代码行数:32,代码来源:BlogMLExportHandler.cs

示例15: Generate

        public void Generate(XmlWriter writer)
        {
            writer.WriteStartElement(@"category");
            writer.WriteAttributeString(@"name", this.Name);

            if (this.InstanceString != null)
                writer.WriteAttributeString(@"instance", this.InstanceString);

            if (this.PublishTimeString != null)
                writer.WriteAttributeString(@"publishTime", this.PublishTimeString);

            if (this.ContainerString != null)
                writer.WriteAttributeString(@"container", this.ContainerString);

            if (this.VersionString != null)
                writer.WriteAttributeString(@"version", this.VersionString);

            if (this.ExpireTypeString != null)
                writer.WriteAttributeString(@"expireType", this.ExpireTypeString);

            //if (this.EndpointId != null)
            //    writer.WriteAttributeString(@"endpointId", this.EndpointId);

            if (this.ExpiresString != null)
                writer.WriteAttributeString(@"expires", this.ExpiresString);

            if (value != null)
                value.Generate(writer);

            writer.WriteEndElement();
        }
开发者ID:hungdluit,项目名称:sipserver,代码行数:31,代码来源:Category.cs


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