XML C#

Create an XML Document

This C# program demonstrates how to create an XML docment in C#.

Program.cs

using System;
using System.IO;
using System.Xml;

// The page is up in a new XML section. I need to transfer it to the  new website location.

namespace CreateDocument {
    class Program {
        static void Main(string[] args) {
            //Create the XmlDocument.
            XmlDocument qXmlDoc = new XmlDocument();
            qXmlDoc.LoadXml("<?xml version='1.0' ?>" +
                "<beginning>" +
                    "<void>Earth</void>" +
                "</beginning>");

            Console.WriteLine("Display the document simply:");
            qXmlDoc.WriteContentTo(new XmlTextWriter(Console.Out));
            // Put "Press any key to continue . . ." on a new line
            Console.WriteLine();
        }
    }
}
 

Output

Display the document simply:
<?xml version="1.0"?><beginning><void>Earth</void></beginning>
Press any key to continue . . .
 
 

© 2007–2024 XoaX.net LLC. All rights reserved.