Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

XDocument DocumentType Property gets the Document Type Definition (DTD) for this document

Imports System Imports System.Xml Imports System.Xml.XPath Public Class MainClass     Public Shared Sub Main()         Dim internalSubset = _                 "<!ELEMENT Pubs (Book+)>" & Environment.NewLine & _                 "<!ELEMENT Book (Title, Author)>" & Environment.NewLine & _                 "<!ELEMENT Title (#PCDATA)>" & Environment.NewLine & _                 "<!ELEMENT Author (#PCDATA)>"                  Dim doc As XDocument = _             <?xml version="1.0" encoding="utf-8" standalone="yes"?>             <!--This is a comment.-->             <?xml-stylesheet href='mystyle.css' title='Compact' type='text/css'?>             <Pubs>                 <Book>                     <Title>Artifacts of Roman Civilization</Title>                     <Author>Moreno, Jordao</Author>                 </Book>                 <Book>                     <Title>Midieval Tools and Implements</Title>                     <Author>Gazit, Inbar</Author>                 </Book>             </Pubs>             <!--This is another comment.-->                  doc.Nodes().Skip(1).First().AddAfterSelf(New XDocumentType("Pubs", Nothing, Nothing, internalSubset))         Console.WriteLine(doc)     End Sub End Class