Writes out the given white space. : XmlTextWriter « XML « C# / C Sharp






Writes out the given white space.

 

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

public class Sample
{  
  public static void Main()
  {
    XmlTextWriter writer = null;
    writer = new XmlTextWriter ("ws.html", null);
    writer.WriteStartElement("p");
    writer.WriteAttributeString("xml", "space", null, "preserve");
    if (writer.XmlSpace == XmlSpace.Preserve)
      Console.WriteLine("xmlspace is correct!");
    writer.WriteString("something");
    writer.WriteWhitespace("  ");
    writer.WriteElementString("b", "B");
    writer.WriteString("ig");
    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 raw markup manually from a string.