Updating the Document Type

image_pdfimage_print
   
 

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

    


This entry was posted in XML LINQ. Bookmark the permalink.