This simple C# example will help you to load the XML doc and Print on the console using Console.WriteLine. LoadXml is used to load the XML from a string into XML Document.
How to LoadXML and Print:
using System;
using System.IO;
using System.Xml;
namespace MyApp
{
class my_XML
{
static void Main(string[] args)
{
XmlDocument objDoc = new XmlDocument();
String strContent = "<Tutorial Type='CSharp_XML'><title>This is CSharp XML Example</title>" +
"</Tutorial>";
objDoc.LoadXml(strContent);
StringWriter objWriter = new StringWriter();
objDoc.Save(objWriter);
String strXML = objWriter.ToString();
Console.WriteLine(strXML);
Console.ReadLine();
}
}
}
No comments:
Post a Comment