File XML

XML introduces a powerful text-based and human-readable format for storing structured data. The .NET Framework provides rich support for XML, including classes in System.Xml and System.Xml.Linq. Some developers dislike XML; others find it a powerful and expressive, yet standardized technology. This section introduces XML methods.
Extensible Markup Language, abbreviated XML, describes a class of data objects called XML documents... The World Wide Web Consortium

This program demonstrates how you can use the System.Xml.Linq namespace to load XML files into XElement objects. There are many other ways to handle XML in the .NET Framework, but the XElement type is one of the easiest.
XElement ExampleExample XML file
<?xml version="1.0"?>
<tag>Test</tag>
Program that loads example XML file [C#]
using System;
using System.Xml.Linq;
class Program
{
static void Main()
{
// Load the XML.
XElement element = XElement.Load("C:\\text.xml");
// Write text value.
Console.WriteLine(element.Value);
}
}
Output
TestThis section shows how to write XML and also read in XML. You could use the general methods in parallel to implement persistence in a C# application.
XmlWriter Tutorial XmlReader ProgramXmlTextWriter and XmlTextReader. You can also find information about XmlTextWriter and XmlTextReader on this site. The XmlTextWriter and Reader types are derived from the XmlWriter and Reader types; they conform to the XML standard.
XmlTextWriter Example XmlTextReader Type
Through the System.Xml and the System.Xml.Linq namespaces in the .NET Framework, we can read and manipulate XML data in the C# language effectively. As a form of data persistence, XML is both standardized and easy-to-use.
HTML Articles