Top Description Fields Methods
com.sun.xml.dtdparser

public Interface DTDEventListener

extends EventListener
Known Direct Implementers
com.sun.xml.dtdparser.DTDHandlerBase
Imports
org.xml.sax.Locator, .SAXException, .SAXParseException, java.util.EventListener

All DTD parsing events are signaled through this interface.

Field Summary

Modifier and TypeField and Description
public static final short
public static final short
public static final short
public static final short
public static final short
public static final short
OCCURENCE_ONCE

Deprecated for removal since 1.5.1. Use OCCURRENCE_ONCE instead.
public static final short
OCCURENCE_ONE_OR_MORE

Deprecated for removal since 1.5.1. Use OCCURRENCE_ONE_OR_MORE instead.
public static final short
OCCURENCE_ZERO_OR_MORE

Deprecated for removal since 1.5.1. Use OCCURRENCE_ZERO_OR_MORE instead.
public static final short
OCCURENCE_ZERO_OR_ONE

Deprecated for removal since 1.5.1. Use OCCURRENCE_ZERO_OR_ONE instead.
public static final short
public static final short
public static final short
public static final short
public static final short
public static final short
public static final short
public static final short
public static final short

Method Summary

Modifier and TypeMethod and Description
public void
attributeDecl(String elementName, String attributeName, String attributeType, String[] enumeration, short attributeUse, String defaultValue)

For each entry in an ATTLIST declaration, this event will be fired.

public void
characters(char[]
The characters from the DTD.
ch
,
int
The start position in the array.
start
,
int
The number of characters to read from the array.
length
)

Receive notification of character data.

public void
childElement(String elementName, short occurrence)

public void
comment(String
the text within the comment delimiters.
text
)

Receive notification that a comment has been read.

public void
connector(short connectorType)

Connectors in one model group is guaranteed to be the same.

public void
endCDATA()

Receive notification that the CDATA section finished.

public void
endContentModel(String elementName, short contentModelType)

receives notification that parsing of content model is finished.

public void
endDTD()

Receive notification of the end of a DTD.

public void
endModelGroup(short occurrence)

public void
public void
externalGeneralEntityDecl(String
The entity name.
name
,
String
The entity's public identifier, or null if none was given.
publicId
,
String
The entity's system identifier.
systemId
)

Receive notification of an external parsed general entity declaration event.

public void
externalParameterEntityDecl(String
The parameter entity name.
name
,
String
The entity's public identifier, or null if none was given.
publicId
,
String
The entity's system identifier.
systemId
)

Receive notification of an external parameter entity declaration event.

public void
public void
ignorableWhitespace(char[]
The characters from the DTD.
ch
,
int
The start position in the array.
start
,
int
The number of characters to read from the array.
length
)

Receive notification of ignorable whitespace in element content.

public void
internalGeneralEntityDecl(String
The internal general entity name.
name
,
String
The value of the entity, which may include unexpanded entity references. Character references will have been expanded.
value
)

Receive notification of a internal general entity declaration event.

public void
internalParameterEntityDecl(String
The internal parameter entity name.
name
,
String
The value of the entity, which may include unexpanded entity references. Character references will have been expanded.
value
)

Receive notification of a internal parameter entity declaration event.

public void
mixedElement(String elementName)

Receives notification of child element of mixed content model.

public void
notationDecl(String
The notation name, referred to by entities and elements.
name
,
String
The public identifier
publicId
,
String
The system identifier
systemId
)

Receive notification of a Notation Declaration.

public void
processingInstruction(String
The target of the processing instruction which should have meaning to the application.
target
,
String
The instruction itself which should contain valid XML characters.
data
)

Receive notification of a Processing Instruction.

public void
public void
startCDATA()

Receive notification that a CDATA section is beginning.

public void
startContentModel(String
name of the element whose content model is going to be defined.
elementName
,
short
CONTENT_MODEL_EMPTY this element has EMPTY content model. This notification will be immediately followed by the corresponding endContentModel. CONTENT_MODEL_ANY this element has ANY content model. This notification will be immediately followed by the corresponding endContentModel. CONTENT_MODEL_MIXED this element has mixed content model. #PCDATA will not be reported. each child element will be reported by mixedElement method. CONTENT_MODEL_CHILDREN this element has child content model. The actual content model will be reported by childElement, startModelGroup, endModelGroup, and connector methods. Possible call sequences are:

START := MODEL_GROUP MODEL_GROUP := startModelGroup TOKEN (connector TOKEN)* endModelGroup TOKEN := childElement | MODEL_GROUP

contentModelType
)

receives notification that parsing of content model is beginning.

public void
startDTD(InputEntity
Current input entity.
in
)

Receive notification of the beginning of the DTD.

public void
public void
unparsedEntityDecl(String
The name of the unparsed entity.
name
,
String
The public identifier
publicId
,
String
The system identifier
systemId
,
String
The associated notation
notationName
)

Receive notification of an unparsed entity declaration.

public void

Field Detail

CHOICEback to summary
public static final short CHOICE
CONTENT_MODEL_ANYback to summary
public static final short CONTENT_MODEL_ANY
CONTENT_MODEL_CHILDRENback to summary
public static final short CONTENT_MODEL_CHILDREN
CONTENT_MODEL_EMPTYback to summary
public static final short CONTENT_MODEL_EMPTY
CONTENT_MODEL_MIXEDback to summary
public static final short CONTENT_MODEL_MIXED
OCCURENCE_ONCEback to summary
public static final short OCCURENCE_ONCE

Deprecated

for removal since 1.5.1.

Use OCCURRENCE_ONCE instead.

Annotations
@Deprecated
since:1.5.1
forRemoval:true
OCCURENCE_ONE_OR_MOREback to summary
public static final short OCCURENCE_ONE_OR_MORE

Deprecated

for removal since 1.5.1.

Use OCCURRENCE_ONE_OR_MORE instead.

Annotations
@Deprecated
since:1.5.1
forRemoval:true
OCCURENCE_ZERO_OR_MOREback to summary
public static final short OCCURENCE_ZERO_OR_MORE

Deprecated

for removal since 1.5.1.

Use OCCURRENCE_ZERO_OR_MORE instead.

Annotations
@Deprecated
since:1.5.1
forRemoval:true
OCCURENCE_ZERO_OR_ONEback to summary
public static final short OCCURENCE_ZERO_OR_ONE

Deprecated

for removal since 1.5.1.

Use OCCURRENCE_ZERO_OR_ONE instead.

Annotations
@Deprecated
since:1.5.1
forRemoval:true
OCCURRENCE_ONCEback to summary
public static final short OCCURRENCE_ONCE
OCCURRENCE_ONE_OR_MOREback to summary
public static final short OCCURRENCE_ONE_OR_MORE
OCCURRENCE_ZERO_OR_MOREback to summary
public static final short OCCURRENCE_ZERO_OR_MORE
OCCURRENCE_ZERO_OR_ONEback to summary
public static final short OCCURRENCE_ZERO_OR_ONE
SEQUENCEback to summary
public static final short SEQUENCE
USE_FIXEDback to summary
public static final short USE_FIXED
USE_IMPLIEDback to summary
public static final short USE_IMPLIED
USE_NORMALback to summary
public static final short USE_NORMAL
USE_REQUIREDback to summary
public static final short USE_REQUIRED

Method Detail

attributeDeclback to summary
public void attributeDecl(String elementName, String attributeName, String attributeType, String[] enumeration, short attributeUse, String defaultValue) throws SAXException

For each entry in an ATTLIST declaration, this event will be fired.

DTD allows the same attributes to be declared more than once, and in that case the first one wins. I think this method will be only fired for the first one, but I need to check.

Exceptions
SAXException:
for errors
charactersback to summary
public void characters(char[] ch, int start, int length) throws SAXException

Receive notification of character data.

The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.

The application must not attempt to read from the array outside of the specified range.

Note that some parsers will report whitespace using the ignorableWhitespace() method rather than this one (validating parsers must do so).

Parameters
ch:char[]

The characters from the DTD.

start:int

The start position in the array.

length:int

The number of characters to read from the array.

Exceptions
SAXException:
for errors
See Also
ignorableWhitespace(char[], int, int)
childElementback to summary
public void childElement(String elementName, short occurrence) throws SAXException
commentback to summary
public void comment(String text) throws SAXException

Receive notification that a comment has been read.

Note that processing instructions are the mechanism designed to hold information for consumption by applications, not comments. XML systems may rely on applications being able to access information found in processing instructions; this is not true of comments, which are typically discarded.

Parameters
text:String

the text within the comment delimiters.

Exceptions
SAXException:
for errors
connectorback to summary
public void connector(short connectorType) throws SAXException

Connectors in one model group is guaranteed to be the same.

IOW, you'll never see an event sequence like (a|b,c)

Exceptions
SAXException:
for errors
endCDATAback to summary
public void endCDATA() throws SAXException

Receive notification that the CDATA section finished.

Exceptions
SAXException:
for errors
See Also
startCDATA()
endContentModelback to summary
public void endContentModel(String elementName, short contentModelType) throws SAXException

receives notification that parsing of content model is finished.

Exceptions
SAXException:
for errors
endDTDback to summary
public void endDTD() throws SAXException

Receive notification of the end of a DTD. The parser will invoke this method only once.

Exceptions
SAXException:
for errors
See Also
startDTD(InputEntity)
endModelGroupback to summary
public void endModelGroup(short occurrence) throws SAXException
errorback to summary
public void error(SAXParseException e) throws SAXException
externalGeneralEntityDeclback to summary
public void externalGeneralEntityDecl(String name, String publicId, String systemId) throws SAXException

Receive notification of an external parsed general 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:String

The entity name.

publicId:String

The entity's public identifier, or null if none was given.

systemId:String

The entity's system identifier.

Exceptions
SAXException:
for errors
See Also
unparsedEntityDecl(String, String, String, String)
externalParameterEntityDeclback to summary
public void externalParameterEntityDecl(String name, String publicId, String systemId) throws SAXException

Receive notification of an external parameter 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:String

The parameter entity name.

publicId:String

The entity's public identifier, or null if none was given.

systemId:String

The entity's system identifier.

Exceptions
SAXException:
for errors
See Also
unparsedEntityDecl(String, String, String, String)
fatalErrorback to summary
public void fatalError(SAXParseException e) throws SAXException
ignorableWhitespaceback to summary
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException

Receive notification of ignorable whitespace in element content.

Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models.

SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.

The application must not attempt to read from the array outside of the specified range.

Parameters
ch:char[]

The characters from the DTD.

start:int

The start position in the array.

length:int

The number of characters to read from the array.

Exceptions
SAXException:
for errors
See Also
characters(char[], int, int)
internalGeneralEntityDeclback to summary
public void internalGeneralEntityDecl(String name, String value) throws SAXException

Receive notification of a internal general entity declaration event.

Parameters
name:String

The internal general entity name.

value:String

The value of the entity, which may include unexpanded entity references. Character references will have been expanded.

Exceptions
SAXException:
for errors
See Also
externalGeneralEntityDecl(String, String, String)
internalParameterEntityDeclback to summary
public void internalParameterEntityDecl(String name, String value) throws SAXException

Receive notification of a internal parameter entity declaration event.

Parameters
name:String

The internal parameter entity name.

value:String

The value of the entity, which may include unexpanded entity references. Character references will have been expanded.

Exceptions
SAXException:
for errors
See Also
externalParameterEntityDecl(String, String, String)
mixedElementback to summary
public void mixedElement(String elementName) throws SAXException

Receives notification of child element of mixed content model. This method is called for each child element.

Exceptions
SAXException:
for errors
See Also
startContentModel(String, short)
notationDeclback to summary
public void notationDecl(String name, String publicId, String systemId) throws SAXException

Receive notification of a Notation Declaration. Notation declarations are used by elements and entities for identifying embedded non-XML data.

Parameters
name:String

The notation name, referred to by entities and elements.

publicId:String

The public identifier

systemId:String

The system identifier

Exceptions
SAXException:
for errors
processingInstructionback to summary
public void processingInstruction(String target, String data) throws SAXException

Receive notification of a Processing Instruction. Processing instructions contain information meaningful to the application.

Parameters
target:String

The target of the processing instruction which should have meaning to the application.

data:String

The instruction itself which should contain valid XML characters.

Exceptions
SAXException:
for errors
setDocumentLocatorback to summary
public void setDocumentLocator(Locator loc)
startCDATAback to summary
public void startCDATA() throws SAXException

Receive notification that a CDATA section is beginning. Data in a CDATA section is reported through the appropriate event, either characters() or ignorableWhitespace.

Exceptions
SAXException:
for errors
See Also
endCDATA()
startContentModelback to summary
public void startContentModel(String elementName, short contentModelType) throws SAXException

receives notification that parsing of content model is beginning.

Parameters
elementName:String

name of the element whose content model is going to be defined.

contentModelType:short

CONTENT_MODEL_EMPTY this element has EMPTY content model. This notification will be immediately followed by the corresponding endContentModel. CONTENT_MODEL_ANY this element has ANY content model. This notification will be immediately followed by the corresponding endContentModel. CONTENT_MODEL_MIXED this element has mixed content model. #PCDATA will not be reported. each child element will be reported by mixedElement method. CONTENT_MODEL_CHILDREN this element has child content model. The actual content model will be reported by childElement, startModelGroup, endModelGroup, and connector methods. Possible call sequences are:

START := MODEL_GROUP MODEL_GROUP := startModelGroup TOKEN (connector TOKEN)* endModelGroup TOKEN := childElement | MODEL_GROUP

Exceptions
SAXException:
for errors
startDTDback to summary
public void startDTD(InputEntity in) throws SAXException

Receive notification of the beginning of the DTD.

Parameters
in:InputEntity

Current input entity.

Exceptions
SAXException:
for errors
See Also
endDTD()
startModelGroupback to summary
public void startModelGroup() throws SAXException
unparsedEntityDeclback to summary
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException

Receive notification of an unparsed entity declaration. Unparsed entities are non-XML data.

Parameters
name:String

The name of the unparsed entity.

publicId:String

The public identifier

systemId:String

The system identifier

notationName:String

The associated notation

Exceptions
SAXException:
for errors
warningback to summary
public void warning(SAXParseException err) throws SAXException