Document Type Declaration Information

The XmlTextReader ensures that the DOCTYPE is well-formed. The XmlTextReader checks the well-formedness of the DOCTYPE using the DTD, but does not do validation using the DTD.

When you call Read on a DOCTYPE node and check the XmlTextReader.NodeType property, the enumeration returned is DocumentType. The PublicLiteral and the SystemLiteral are considered attributes. The attribute names are PUBLIC and SYSTEM. To retrieve the content of the attribute, use GetAttribute or another attribute accessing method. For example, if you have the following DOCTYPE:

<!DOCTYPE bookstore SYSTEM \\valid_url\books.dtd [<!ENTITY e 'ent'>]>

the following table list what is returned for the GetAttribute and Value properties.

Code Value Returned
myReader.GetAttribute("SYSTEM") \\valid_url\books.dtd
myReader.Value <!ENTITY e 'ent'>

For more information, see XmlReader.GetAttribute and XmlReader.Value.

See Also

Reading XML with the XmlReader | Full Content Reads using Character Streams | Handling White Space with XmlTextReader | Attribute Value Normalization | Exception Handling using XmlException in XmlTextReader | XmlReader Class | XmlReader Members | XmlNodeReader Class | XmlNodeReader Members | XmlTextReader Class | XmlTextReader Members | XmlValidatingReader Class | XmlValidatingReader