Update the XDocument Name, SystemId and PublicId in CSharp
Description
The following code shows how to update the XDocument Name, SystemId and PublicId.
Example
/*from w w w . java2 s. c om*/
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Linq;
public class MainClass {
public static void Main() {
XDocumentType docType;
XDocument xDocument = new XDocument(docType = new XDocumentType("Books", null,"Books.dtd", null),
new XElement("Books"));
Console.WriteLine("Before updating document type:");
Console.WriteLine(xDocument);
docType.Name = "MyBooks";
docType.SystemId = "http://www.yoursite.com/DTDs/MyBooks.DTD";
docType.PublicId = "-//DTDs//TEXT Book Participants//EN";
Console.WriteLine(xDocument);
}
}