Csharp/C Sharp/XML LINQ/XDocumentType — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 14:34, 26 мая 2010
Creating a Document Type
<source lang="csharp"> 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() { XDocument xDocument = new XDocument(new XDocumentType("Books",null,"Books.dtd", null),new XElement("Book")); Console.WriteLine(xDocument); }
}
</source>
Creating a Document Type and Adding It to a Document
<source lang="csharp"> 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() { XDocument xDocument = new XDocument(); XDocumentType documentType = new XDocumentType("Books", null, "Books.dtd", null); xDocument.Add(documentType, new XElement("Books")); Console.WriteLine(xDocument); }
}
</source>