Updating the Document Type : XElement Update « XML LINQ « C# / C Sharp






Updating the Document Type

 

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);
    }
}

 








Related examples in the same category

1.Updating a Node's Value
2.Updating a Processing Instruction