LoadXml : XmlDocument « XML « C# / C Sharp






LoadXml

   

using System;
using System.IO;
using System.Xml;
public class BookListing {
    public static void Main() {
        XmlDocument doc = new XmlDocument();
        String entry = "<book genre='biography'" +
         " ISBN='1111111111'><title>my title</title>" +
         "</book>";
        doc.LoadXml(entry);

        StringWriter writer = new StringWriter();
        doc.Save(writer); // to StringWriter
        String strXML = writer.ToString(); // to String
        Console.WriteLine(strXML);
    }
}

   
    
  








Related examples in the same category

1.A Simple XML Example
2.Save, AppendChild, CreateXmlDeclaration, CreateElement
3.Call GetElementsByTagName to get an element
4.Use Load method in XmlDocument to load xml document
5.Use SelectNodes to query nodes by XPath
6.Get XML Nodes in a Specific XML Namespace
7.Find Elements with an XPath Search
8.Add XmlElement
9.Load With Includes
10.Non CData Normalize