Writes raw markup manually from a string. : XmlTextWriter « XML « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Date Time
8.Design Patterns
9.Development Class
10.Event
11.File Stream
12.Generics
13.GUI Windows Form
14.Internationalization I18N
15.Language Basics
16.LINQ
17.Network
18.Office
19.Reflection
20.Regular Expressions
21.Security
22.Services Event
23.Thread
24.Web Services
25.Windows
26.Windows Presentation Foundation
27.XML
28.XML LINQ
C# / C Sharp » XML » XmlTextWriter 




Writes raw markup manually from a string.
 

using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {
     XmlTextWriter writer = new XmlTextWriter (Console.Out);
     writer.Formatting = Formatting.Indented;
     writer.WriteStartElement("Items");
     writer.WriteStartElement("Item");
     writer.WriteString("Write unescaped text:  ");
     writer.WriteRaw("this & that");
     writer.WriteEndElement();
     writer.WriteStartElement("Item");
     writer.WriteString("Write the same string using WriteString:  ");
     writer.WriteString("this & that");
     writer.WriteEndElement();
     writer.WriteEndElement();
     writer.Close();  
  }

}

   
  














Related examples in the same category
1.Use XmlTextWriter to create Xml document
2.Write attribute
3.Close an element
4.Control the formatting
5.Write the double value out
6.Closes this stream and the underlying stream.
7.Flush what is in the buffer to the underlying streams and flush the underlying stream.
8.XmlTextWriter.Indentation Property gets or sets how many IndentChars to write
9.XmlTextWriter.LookupPrefix returns the closest prefix in the current namespace scope
10.XmlTextWriter.WriteCData writes out a block containing the specified text.
11.Use specified Unicode character value.
12.Closes one element and pops the corresponding namespace scope.
13.Writes out the namespace-qualified name.
14.Writes out the given white space.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.