Поделиться через


XDocument.DocumentType Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the Document Type Definition (DTD) for this document.

Namespace:  System.Xml.Linq
Assembly:  System.Xml.Linq (in System.Xml.Linq.dll)

Syntax

'Declaration
Public ReadOnly Property DocumentType As XDocumentType
public XDocumentType DocumentType { get; }

Property Value

Type: System.Xml.Linq.XDocumentType
A XDocumentType that contains the DTD for this document.

Remarks

LINQ to XML provides limited support for DTDs.

You can populate an XML tree with an XML document that contains a DTD. The XML tree will then contain a DocumentType node. When you serialize or save the tree, the DTD will also be serialized. LINQ to XML will expand any entities in the DTD. When you serialize or save the XML tree, the entity references are not saved; instead, the nodes are saved with the entity references replaced by the text of the entity.

If the DTD contains default attributes, the attributes are created in the XML tree as ordinary attributes.

By default, LINQ to XML does not validate a document based on its DTD. To validate a document based on a DTD, create an XmlReader that will validate based on a DTD, and then create an XML tree from the XmlReader.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.