Parse XML file

In this chapter you will learn:

  1. Load xml from xml file directly

Load xml from xml file directly

using System;//from  j ava2 s .c o  m
using System.Xml;

class MainClass
{
  static void Main(string[] args)
  {
    string filename = @"C:\books.xml";     
    XmlDocument xmlDoc = new XmlDocument();    
    xmlDoc.LoadXml(filename);
        xmlDoc.Save(Console.Out);
  }    
}

Next chapter...

What you will learn in the next chapter:

  1. Load XML data from string
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