Output XML to console

In this chapter you will learn:

  1. How to print XML document to console

Output XML to console

using System;/* j ava  2  s  .  c o  m*/
using System.Xml;

class MainClass
{
  static void Main(string[] args)
  {
    XmlDocument xmlDoc = new XmlDocument();    
    xmlDoc.LoadXml("<Record> write something</Record>");

        xmlDoc.Save(Console.Out);
  }    
 
}

The code above generates the following result.

Next chapter...

What you will learn in the next chapter:

  1. What can web do with XDocument
  2. Create XML file with XDocument
Home » C# Tutorial » XML
Parse XML file
Parse XML String
Parse XML from URL
Element create
Attribute create
Comments create
XProcessingInstruction
XmlReader
Read double value from XML
XmlReader
XmlReaderSettings
XML formatter
XmlSerializer
XmlTextReader
XmlTextWriter
XmlWriter
XmlWriterSettings
Output XML to console