Export (0) Print
Expand All

XDocumentType Class

Represents an XML Document Type Definition (DTD).

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

public ref class XDocumentType : public XNode

Data Type Definitions (DTD) in XML are a way to do the following:

  • Validate XML trees to a limited extent.

  • Expand entities, which is a form of text replacement.

  • Supply default attributes.

This class represents the XML concept of a DTD.

DTD support in LINQ to XML is limited. 

LINQ to XML will expand internal entities by default, but it will not resolve external entity references unless an XmlReader with an associated XmlResolver is used to load the XML tree.

LINQ to XML will not validate a document against a DTD, but you can use a validating XmlReader to perform DTD validation if necessary.

To validate an LINQ to XML tree against an XML schema, use the Validate method.

When a document contains entity references that are defined in a DTD, the references are expanded upon creation of the XML tree. However, when you serialize or save the XML tree, the content of the expanded entities is preserved; the entity references are not.

Default attributes from the DTD will be materialized as regular attributes in the XML tree. After a default attribute from the DTD is materialized, there is no way to determine that the attribute was a default attribute from the DTD.

You can populate an XML tree with an XML document that contains an internal DTD. The XML tree will then contain a DocumentType node. When you serialize or save the tree, the internal DTD will also be saved as part of the document.

System::Object
  System.Xml.Linq::XObject
    System.Xml.Linq::XNode
      System.Xml.Linq::XDocumentType

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5

.NET Compact Framework

Supported in: 3.5

XNA Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft