using System;
using System.Linq;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass{
public static void Main(){
string internalSubset = @"
";
string target = "xml-stylesheet";
string data = "href='mystyle.css' title='Compact' type='text/css'";
XDocument doc = new XDocument(
new XComment("This is a comment."),
new XProcessingInstruction(target, data),
new XDocumentType("Pubs", null, null, internalSubset),
new XElement("Pubs",
new XElement("Book",
new XElement("Title", "C#"),
new XElement("Author", "Name")
)
),
new XComment("This is another comment.")
);
doc.Declaration = new XDeclaration("1.0", "utf-8", "true");
Console.WriteLine(doc);
doc.Save("test.xml");
}
}