com.sun.xml.parser
Interface DtdEventListener


public abstract interface DtdEventListener
extends DTDHandler

When parsing XML documents, DTD related events are signaled through this interface. Examples include the beginning and end of the DTD, entity declarations, and parts of the <!DOCTYPE...> declaration. This interface supports:

Events signaled through the DTDHandler interface will only signaled after at startDtd event and before an endDtd event.

Other than the support to recreate the DOCTYPE declaration, parameter entities are not exposed.

See Also:
Parser

Method Summary
 void attributeDecl(java.lang.String elementName, java.lang.String attributeName, java.lang.String attributeType, java.lang.String[] options, java.lang.String defaultValue, boolean isFixed, boolean isRequired)
          Reports an attribute declaration found within the DTD.
 void elementDecl(java.lang.String elementName, java.lang.String contentModel)
          Reports an element declaration found within the DTD.
 void endDtd()
          Receive notification of the end of a DTD.
 void externalDtdDecl(java.lang.String publicId, java.lang.String systemId)
          Reports the optional unnamed parameter entity which is processed after the internal DTD subset.
 void externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Receive notification of an external parsed entity declaration event.
 void internalDtdDecl(java.lang.String internalSubset)
          Reports the internal DTD subset, as unparsed markup declarations.
 void internalEntityDecl(java.lang.String name, java.lang.String value)
          Receive notification of a internal parsed entity declaration event.
 void startDtd(java.lang.String rootName)
          Receive notification of the beginning of a Document Type Declaration (DTD).
 
Methods inherited from interface org.xml.sax.DTDHandler
notationDecl, unparsedEntityDecl
 

Method Detail

startDtd

public void startDtd(java.lang.String rootName)
              throws SAXException
Receive notification of the beginning of a Document Type Declaration (DTD). The parser will invoke this method only once, before any other methods in this interface.
Parameters:
rootName - The declared name of the root element, which may be different from the actual name if the document is not valid.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
endDtd()

externalDtdDecl

public void externalDtdDecl(java.lang.String publicId,
                            java.lang.String systemId)
                     throws SAXException
Reports the optional unnamed parameter entity which is processed after the internal DTD subset. This commonly provides the entire external DTD subset, in case where the internal DTD subset does not define and use external parameter entities. The parser will invoke this method at most once.
Parameters:
publicId - The entity's public identifier, or null if none was given.
systemId - The entity's system identifier.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
internalDtdDecl(java.lang.String)

internalDtdDecl

public void internalDtdDecl(java.lang.String internalSubset)
                     throws SAXException
Reports the internal DTD subset, as unparsed markup declarations. This may also contain comments and processing instructions, if they are found in the document source. Applications should treat this string as opaque, only using it when recreating a <!DOCTYPE ...> declaration. The parser will invoke this method at most once.
Parameters:
internalSubset - The document's internal subset, as unparsed markup declarations, comments, and processing instructions.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
externalDtdDecl(java.lang.String, java.lang.String)

internalEntityDecl

public void internalEntityDecl(java.lang.String name,
                               java.lang.String value)
                        throws SAXException
Receive notification of a internal parsed entity declaration event.
Parameters:
name - The internal entity name.
value - the value of the entity, which may include unexpanded entity references. Character references will have been expanded.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)

externalEntityDecl

public void externalEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId)
                        throws SAXException
Receive notification of an external parsed entity declaration event.

If a system identifier is present, and it is a relative URL, the parser will have resolved it fully before passing it through this method to a listener.

Parameters:
name - The entity name.
publicId - The entity's public identifier, or null if none was given.
systemId - The entity's system identifier.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

elementDecl

public void elementDecl(java.lang.String elementName,
                        java.lang.String contentModel)
                 throws SAXException
Reports an element declaration found within the DTD. The content model will be a string such as "ANY", "EMPTY", "(#PCDATA|foo)*", or "(caption?,tr*)".
Parameters:
elementName - The name of the element; this includes a namespace prefix if one was used within the DTD.
contentModel - The content model as defined in the DTD, with any whitespace removed.

attributeDecl

public void attributeDecl(java.lang.String elementName,
                          java.lang.String attributeName,
                          java.lang.String attributeType,
                          java.lang.String[] options,
                          java.lang.String defaultValue,
                          boolean isFixed,
                          boolean isRequired)
                   throws SAXException
Reports an attribute declaration found within the DTD.
Parameters:
elementName - The name of the element to which the attribute applies; this includes a namespace prefix if one was used within the DTD.
attributeName - The name of the attribute being declared; this includes a namespace prefix if one was used within the DTD.
attributeType - The type of the attribute, either CDATA, NMTOKEN, NMTOKENS, ENTITY, ENTITIES, NOTATION, ID, IDREF, or IDREFS as defined in the XML specification; or null for enumerations.
options - When attributeType is null or NOTATION, this is an array of the values which are permitted; it is otherwise null.
defaultValue - When not null, this provides the default value of this attribute.
isFixed - When true, the defaultValue is the only legal value. (Precludes isRequired.)
isRequired - When true, the attribute value must be provided for each element of the named type. (Precludes isFixed.)

endDtd

public void endDtd()
            throws SAXException
Receive notification of the end of a DTD. The parser will invoke this method only once.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
startDtd(java.lang.String)


Submit Feedback to xml-feedback@java.sun.com