XmlWriter.WriteStartElement Method (String)
.NET Framework 2.0
When overridden in a derived class, writes out a start tag with the specified local name.
Namespace: System.Xml
Assembly: System.Xml (in system.xml.dll)
Assembly: System.Xml (in system.xml.dll)
The following example writes an XML node.
using System; using System.IO; using System.Xml; public class Sample { public static void Main() { // Create a writer to write XML to the console. XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.OmitXmlDeclaration = true; XmlWriter writer = XmlWriter.Create(Console.Out, settings); // Write the book element. writer.WriteStartElement("book"); // Write the title element. writer.WriteStartElement("title"); writer.WriteString("Pride And Prejudice"); writer.WriteEndElement(); // Write the close tag for the root element. writer.WriteEndElement(); // Write the XML and close the writer. writer.Close(); } }
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.