Name

DocumentType

Synopsis

This interface represents the Document Type Declaration, or DTD of a document. Because the DTD is not part of the document itself, a DocumentType object is not part of DOM document tree, even though it extends the Node interface. If a Document has a DTD, then you may obtain the DocumentType object that represents it by calling the getDoctype( ) method of the Document object.

getName( ), getPublicId( ), getSystemId( ), and getInternalSubset( ) all return strings (or null) that contain the name, public identifier, system identifier, and internal subset of the document type. getEntities( ) returns a read-only NamedNodeMap that represents the name-to-value mapping for all internal and external general entities declared by the DTD. You can use this NamedNodeMap to lookup an Entity object by name. Similarly, getNotations( ) returns a read-only NamedNodeMap that allows you to look up a Notation object declared in the DTD by name.

DocumentType does not provide access to the bulk of a DTD, which usually consists of element and attribute delcarations. Future versions of the DOM API may provide more details.

org.w3c.dom.DocumentType

Figure 21-7. org.w3c.dom.DocumentType

public interface DocumentType extends Node {
// Public Instance Methods
     NamedNodeMap getEntities( );  
     String getInternalSubset( );  
     String getName( );  
     NamedNodeMap getNotations( );  
     String getPublicId( );  
     String getSystemId( ); ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.