Output XmlDocument to Console : Xml Display « XML « C# / CSharp Tutorial






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

public class MainClass
{
  public static void Main()
  {
    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.LoadXml("<book genre='programming'> <title>ADO.NET Programming</title> </book>");

    XmlNode root = xmlDoc.DocumentElement;
    Console.WriteLine("XML Document Fragment");

    xmlDoc.Save(Console.Out);
    Console.WriteLine();


    Console.WriteLine("XML Document Fragment After RemoveAll");
    root.RemoveAll();

    xmlDoc.Save(Console.Out);
  }
}
XML Document Fragment


  ADO.NET Programming

XML Document Fragment After RemoveAll










30.16.Xml Display
30.16.1.Output XmlDocument to Console
30.16.2.Save XML document to console and through XmlTextWriter