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


C# XmlWriter.WriteCData方法代码示例

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


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

示例1: WriteTo

        public void WriteTo(XmlWriter x)
        {
            x.WriteStartElement("NACL_SDK_ROOT");
            x.WriteCData(NACL_SDK_ROOT);
            x.WriteEndElement();

            x.WriteStartElement("NACL_MONO_ROOT");
            x.WriteCData(NACL_MONO_ROOT);
            x.WriteEndElement();
        }
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:10,代码来源:MonoNaClSettingsService.cs

示例2: WriteTo

		public void WriteTo (XmlWriter w)
		{
			w.WriteStartElement ("cmd");
			w.WriteCData (DubCommand);
			w.WriteEndElement ();

			w.WriteStartElement ("commonargs");
			w.WriteCData (CommonArgs);
			w.WriteEndElement ();
		}
开发者ID:DinrusGroup,项目名称:Mono-D,代码行数:10,代码来源:DubSettings.cs

示例3: Save

        internal static void Save(XmlWriter x)
        {
            x.WriteStartElement("UnittestCommand");
            x.WriteCData(UnittestCommand);
            x.WriteEndElement();

            x.WriteStartElement("MainMethodFlag");
            x.WriteCData(MainMethodFlag);
            x.WriteEndElement();
        }
开发者ID:Geod24,项目名称:Mono-D,代码行数:10,代码来源:UnittestSettings.cs

示例4: generateXml

 private void generateXml(XmlWriter writer)
 {
     writer.WriteStartDocument();
     writer.WriteStartElement("results");
     foreach (var runner in _results.GroupBy(x => x.Runner))
     {
         writer.WriteStartElement("runner");
         writer.WriteAttributeString("id", runner.Key);
         foreach (var assembly in runner.GroupBy(x => x.Assembly))
         {
             writer.WriteStartElement("assembly");
             writer.WriteAttributeString("name", assembly.Key);
             foreach (var fixture in assembly.GroupBy(x => x.TestFixture))
             {
                 writer.WriteStartElement("fixture");
                 writer.WriteAttributeString("name", fixture.Key);
                 foreach (var test in fixture)
                 {
                     writer.WriteStartElement("test");
                     writer.WriteAttributeString("state", test.State.ToString());
                     writer.WriteAttributeString("name", test.TestName);
                     if (test.TestDisplayName != null)
                         writer.WriteAttributeString("displayName", test.TestDisplayName);
                     writer.WriteAttributeString("duration", test.DurationInMilliseconds.ToString());
                     writer.WriteStartElement("message");
                     writer.WriteCData(test.Message);
                     writer.WriteEndElement();
                     if (test.State == TestState.Failed || test.State == TestState.Ignored)
                     {
                         writer.WriteStartElement("stack-trace");
                         foreach (var line in test.StackLines)
                         {
                             writer.WriteStartElement("line");
                             writer.WriteStartElement("method");
                             writer.WriteCData(line.Method);
                             writer.WriteEndElement();
                             writer.WriteStartElement("file");
                             writer.WriteAttributeString("line", line.Line.ToString());
                             writer.WriteRaw(line.File);
                             writer.WriteEndElement();
                             writer.WriteEndElement();
                         }
                         writer.WriteEndElement();
                     }
                     writer.WriteEndElement();
                 }
                 writer.WriteEndElement();
             }
             writer.WriteEndElement();
         }
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
 }
开发者ID:JamesTryand,项目名称:AutoTest.Net,代码行数:54,代码来源:ResultsXmlWriter.cs

示例5: SaveTo

        public void SaveTo(XmlWriter x)
        {
            x.WriteStartElement ("CompilerArg");
            x.WriteCData (CompilerArguments);
            x.WriteEndElement ();

            x.WriteStartElement ("LinkerArgs");
            x.WriteCData (LinkerArguments);
            x.WriteEndElement ();

            x.WriteStartElement ("OneStepBuildArgs");
            x.WriteCData (OneStepBuildArguments);
            x.WriteEndElement ();
        }
开发者ID:rikkimax,项目名称:Mono-D,代码行数:14,代码来源:DCompilerConfiguration.cs

示例6: WriteEscapedXmlString

		/// <summary>
		/// Write a string to an XmlWriter
		/// </summary>
		/// <param name="writer">the writer to write to</param>
		/// <param name="text">the string to write</param>
		/// <remarks>
		/// The test is escaped either using XML escape entities
		/// or using CDATA sections.
		/// </remarks>
		public static void WriteEscapedXmlString(XmlWriter writer, string text)
		{
			// Write either escaped text or CDATA sections

			int weightCData = 12 * (1 + CountSubstrings(text, CDATA_END));
			int weightStringEscapes = 3*(CountSubstrings(text, "<") + CountSubstrings(text, ">")) + 4*CountSubstrings(text, "&");

			if (weightStringEscapes <= weightCData)
			{
				// Write string using string escapes
				writer.WriteString(text);
			}
			else
			{
				// Write string using CDATA section

				int end = text.IndexOf(CDATA_END);
	
				if (end < 0) 
				{
					writer.WriteCData(text);
				}
				else
				{
					int start = 0;
					while (end > -1) 
					{
						writer.WriteCData(text.Substring(start, end - start));
						if (end == text.Length - 3)
						{
							start = text.Length;
							writer.WriteString(CDATA_END);
							break;
						}
						else
						{
							writer.WriteString(CDATA_UNESCAPABLE_TOKEN);
							start = end + 2;
							end = text.IndexOf(CDATA_END, start);
						}
					}
	
					if (start < text.Length)
					{
						writer.WriteCData(text.Substring(start));
					}
				}
			}
		}
开发者ID:WolfeReiter,项目名称:clamav-csharp-client,代码行数:58,代码来源:Transform.cs

示例7: FormatXml

        protected override void FormatXml(XmlWriter writer, LoggingEvent loggingEvent)
        {
            writer.WriteStartElement("LogEntry");

              writer.WriteStartElement("Level");
              writer.WriteString(loggingEvent.Level.DisplayName);
              writer.WriteEndElement();

              writer.WriteStartElement("Message");
              writer.WriteCData(loggingEvent.RenderedMessage);
              writer.WriteEndElement();

              writer.WriteStartElement("Details");
              if (loggingEvent.ExceptionObject != null)
            writer.WriteCData(loggingEvent.ExceptionObject.ToString());
              writer.WriteEndElement();

              writer.WriteStartElement("StackTrace");

              if (loggingEvent.ExceptionObject != null)
              {
            writer.WriteCData(string.IsNullOrEmpty(loggingEvent.ExceptionObject.StackTrace) ? string.Empty : loggingEvent.ExceptionObject.StackTrace);
            //Exception Details
            {
              // Get stack trace for the exception with source file information
              var st = new StackTrace(loggingEvent.ExceptionObject, true);
              // Get the top stack frame
              var frame = st.GetFrame(0);

              if (frame != null)
              {
            // Get the line number from the stack frame
            var line = frame.GetFileLineNumber();

            string error_dtls = string.Format("\nFile: {0} -> Line:{1}", frame.GetFileName(), frame.GetFileLineNumber());
            writer.WriteCData(error_dtls);
              }
            }

            writer.WriteEndElement();
              }

              writer.WriteStartElement("TimeStamp");
              writer.WriteString(loggingEvent.TimeStamp.ToString("dd/MM/yyyy HH:mm:ss"));
              writer.WriteEndElement();

              writer.WriteEndElement();
        }
开发者ID:mustafamagdy,项目名称:GTExtensions,代码行数:48,代码来源:Logger.cs

示例8: 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:doct15,项目名称:blogengine,代码行数:32,代码来源:BlogMLExportHandler.cs

示例9: AddCategories

        private static void AddCategories(XmlWriter writer)
        {
            writer.WriteStartElement("categories");

            foreach (Category category in Category.Categories)
            {
                writer.WriteStartElement("category");

                writer.WriteAttributeString("id", category.Id.ToString());
                writer.WriteAttributeString("date-created", category.DateCreated.ToString("yyyy-MM-ddTHH:mm:ss"));
                writer.WriteAttributeString("date-modified", category.DateModified.ToString("yyyy-MM-ddTHH:mm:ss"));
                writer.WriteAttributeString("approved", "true");
                writer.WriteAttributeString("parentref", "0");

                if (!String.IsNullOrEmpty(category.Description))
                {
                    writer.WriteAttributeString("description", category.Description);
                }

                writer.WriteStartElement("title");
                writer.WriteAttributeString("type", "text");
                writer.WriteCData(category.Title);
                writer.WriteEndElement();

                writer.WriteEndElement();
            }

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

示例10: SerializeElement

        protected override bool SerializeElement(XmlWriter writer, bool serializeCollectionKey)
        {
            if (writer != null)
                writer.WriteCData(Value);

            return true;
        }
开发者ID:Cocotus,项目名称:ssh-tunnel-agent,代码行数:7,代码来源:TextConfigurationElement.cs

示例11: Write

 protected override void Write(XmlWriter writer)
 {
     writer.WriteElementString("_type", "2");
     writer.WriteStartElement("char");
     writer.WriteCData(m_char.ToString());
     writer.WriteEndElement();
 }
开发者ID:saykonot,项目名称:classicreports4net,代码行数:7,代码来源:HorizontalLineWidget.cs

示例12: Write

 protected override void Write(XmlWriter writer)
 {
     writer.WriteElementString("_type", "0");
     writer.WriteStartElement("text");
     writer.WriteCData(m_text);
     writer.WriteEndElement();
 }
开发者ID:saykonot,项目名称:classicreports4net,代码行数:7,代码来源:TextWidget.cs

示例13: WriteNode

 private static void WriteNode(XmlReader reader, XmlWriter writer)
 {
     while (reader.Read())
     {
         switch (reader.NodeType)
         {
         case XmlNodeType.Element:
             writer.WriteStartElement(reader.Name);
             break;
         case XmlNodeType.Text:
             writer.WriteString(reader.Value);
             break;
         case XmlNodeType.CDATA:
             writer.WriteCData(reader.Value);
             break;
         case XmlNodeType.ProcessingInstruction:
             writer.WriteProcessingInstruction(reader.Name, reader.Value);
             break;
         case XmlNodeType.Comment:
             writer.WriteComment(reader.Value);
             break;
         case XmlNodeType.XmlDeclaration:
             break;
         case XmlNodeType.Document:
             break;
         case XmlNodeType.DocumentType:
             break;
         case XmlNodeType.EntityReference:
             break;
         case XmlNodeType.EndElement:
             writer.WriteEndElement();
             break;
         }
     }
 }
开发者ID:platformdotnet,项目名称:Platform,代码行数:35,代码来源:XmlNodeNodeTypeSerializer.cs

示例14: SerializeToXmlElement

 protected override bool SerializeToXmlElement(XmlWriter writer, string elementName)
 {
     if (writer == null)
         return true;
     writer.WriteStartElement(elementName);
     writer.WriteCData(Sql);
     writer.WriteEndElement();
     return false;
 }
开发者ID:jhgbrt,项目名称:DbMigrations,代码行数:9,代码来源:QueryConfigurationElement.cs

示例15: Save

		public void Save(XmlWriter x)
		{
			x.WriteStartDocument();

			x.WriteStartElement("ResourceFileBinding");

			x.WriteStartElement("CompilerPath");
			x.WriteCData(ResourceCompilerPath);
			x.WriteEndElement();

			x.WriteStartElement("CompilerArguments");
			x.WriteCData(ResourceCompilerArguments);
			x.WriteEndElement();

			/*
			x.WriteStartElement("BracketHightlighting");
			x.WriteAttributeString("value", EnableMatchingBracketHighlighting.ToString().ToLower());
			x.WriteEndElement();
			*/
			x.WriteEndElement();
		}
开发者ID:DinrusGroup,项目名称:D-IDE,代码行数:21,代码来源:ResConfig.cs


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