com.sun.msv.scanner.dtd
Interface DTDEventListener

All Superinterfaces:
EventListener
All Known Implementing Classes:
DTDHandlerBase, DTDReader

public interface DTDEventListener
extends EventListener

All DTD parsing events are signaled through this interface.


Field Summary
static short CHOICE
           
static short CONTENT_MODEL_ANY
           
static short CONTENT_MODEL_CHILDREN
           
static short CONTENT_MODEL_EMPTY
           
static short CONTENT_MODEL_MIXED
           
static short OCCURENCE_ONCE
           
static short OCCURENCE_ONE_OR_MORE
           
static short OCCURENCE_ZERO_OR_MORE
           
static short OCCURENCE_ZERO_OR_ONE
           
static short SEQUENCE
           
static short USE_FIXED
           
static short USE_IMPLIED
           
static short USE_NORMAL
           
static short USE_REQUIRED
           
 
Method Summary
 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.
 void characters(char[] ch, int start, int length)
          Receive notification of character data.
 void childElement(String elementName, short occurence)
           
 void comment(String text)
          Receive notification that a comment has been read.
 void connector(short connectorType)
          Connectors in one model group is guaranteed to be the same.
 void endCDATA()
          Receive notification that the CDATA section finished.
 void endContentModel(String elementName, short contentModelType)
          receives notification that parsing of content model is finished.
 void endDTD()
          Receive notification of the end of a DTD.
 void endModelGroup(short occurence)
           
 void error(SAXParseException e)
           
 void externalGeneralEntityDecl(String name, String publicId, String systemId)
          Receive notification of an external parsed general entity declaration event.
 void externalParameterEntityDecl(String name, String publicId, String systemId)
          Receive notification of an external parameter entity declaration event.
 void fatalError(SAXParseException e)
           
 void ignorableWhitespace(char[] ch, int start, int length)
          Receive notification of ignorable whitespace in element content.
 void internalGeneralEntityDecl(String name, String value)
          Receive notification of a internal general entity declaration event.
 void internalParameterEntityDecl(String name, String value)
          Receive notification of a internal parameter entity declaration event.
 void mixedElement(String elementName)
          receives notification of child element of mixed content model.
 void notationDecl(String name, String publicId, String systemId)
          Receive notification of a Notation Declaration.
 void processingInstruction(String target, String data)
          Receive notification of a Processing Instruction.
 void setDocumentLocator(Locator loc)
           
 void startCDATA()
          Receive notification that a CDATA section is beginning.
 void startContentModel(String elementName, short contentModelType)
          receives notification that parsing of content model is beginning.
 void startDTD(InputEntity in)
          Receive notification of the beginning of the DTD.
 void startModelGroup()
           
 void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
          Receive notification of an unparsed entity declaration.
 void warning(SAXParseException err)
           
 

Field Detail

CONTENT_MODEL_EMPTY

static final short CONTENT_MODEL_EMPTY
See Also:
Constant Field Values

CONTENT_MODEL_ANY

static final short CONTENT_MODEL_ANY
See Also:
Constant Field Values

CONTENT_MODEL_MIXED

static final short CONTENT_MODEL_MIXED
See Also:
Constant Field Values

CONTENT_MODEL_CHILDREN

static final short CONTENT_MODEL_CHILDREN
See Also:
Constant Field Values

USE_NORMAL

static final short USE_NORMAL
See Also:
Constant Field Values

USE_IMPLIED

static final short USE_IMPLIED
See Also:
Constant Field Values

USE_FIXED

static final short USE_FIXED
See Also:
Constant Field Values

USE_REQUIRED

static final short USE_REQUIRED
See Also:
Constant Field Values

CHOICE

static final short CHOICE
See Also:
Constant Field Values

SEQUENCE

static final short SEQUENCE
See Also:
Constant Field Values

OCCURENCE_ZERO_OR_MORE

static final short OCCURENCE_ZERO_OR_MORE
See Also:
Constant Field Values

OCCURENCE_ONE_OR_MORE

static final short OCCURENCE_ONE_OR_MORE
See Also:
Constant Field Values

OCCURENCE_ZERO_OR_ONE

static final short OCCURENCE_ZERO_OR_ONE
See Also:
Constant Field Values

OCCURENCE_ONCE

static final short OCCURENCE_ONCE
See Also:
Constant Field Values
Method Detail

setDocumentLocator

void setDocumentLocator(Locator loc)

processingInstruction

void processingInstruction(String target,
                           String data)
                           throws SAXException
Receive notification of a Processing Instruction. Processing instructions contain information meaningful to the application.

Parameters:
target - The target of the proceessing instruction which should have meaning to the application.
data - The instruction itself which should contain valid XML characters.
Throws:
SAXException

notationDecl

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 - The notation name, referred to by entities and elements.
publicId - The public identifier
systemId - The system identifier
Throws:
SAXException

unparsedEntityDecl

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 - The name of the unparsed entity.
publicId - The public identifier
systemId - The system identifier
notationName - The associated notation
Throws:
SAXException

internalGeneralEntityDecl

void internalGeneralEntityDecl(String name,
                               String value)
                               throws SAXException
Receive notification of a internal general entity declaration event.

Parameters:
name - The internal general entity name.
value - The value of the entity, which may include unexpanded entity references. Character references will have been expanded.
Throws:
SAXException
See Also:
externalGeneralEntityDecl(String, String, String)

externalGeneralEntityDecl

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 - The entity name.
publicId - The entity's public identifier, or null if none was given.
systemId - The entity's system identifier.
Throws:
SAXException
See Also:
unparsedEntityDecl(String, String, String, String)

internalParameterEntityDecl

void internalParameterEntityDecl(String name,
                                 String value)
                                 throws SAXException
Receive notification of a internal parameter entity declaration event.

Parameters:
name - The internal parameter entity name.
value - The value of the entity, which may include unexpanded entity references. Character references will have been expanded.
Throws:
SAXException
See Also:
externalParameterEntityDecl(String, String, String)

externalParameterEntityDecl

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 - The parameter entity name.
publicId - The entity's public identifier, or null if none was given.
systemId - The entity's system identifier.
Throws:
SAXException
See Also:
unparsedEntityDecl(String, String, String, String)

startDTD

void startDTD(InputEntity in)
              throws SAXException
Receive notification of the beginning of the DTD.

Parameters:
in - Current input entity.
Throws:
SAXException
See Also:
endDTD()

endDTD

void endDTD()
            throws SAXException
Receive notification of the end of a DTD. The parser will invoke this method only once.

Throws:
SAXException
See Also:
startDTD(InputEntity)

comment

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 - the text within the comment delimiters.
Throws:
SAXException

characters

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 - The characters from the DTD.
start - The start position in the array.
length - The number of characters to read from the array.
Throws:
SAXException
See Also:
ignorableWhitespace(char[], int, int)

ignorableWhitespace

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 - The characters from the DTD.
start - The start position in the array.
length - The number of characters to read from the array.
Throws:
SAXException
See Also:
characters(char[], int, int)

startCDATA

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

Throws:
SAXException
See Also:
endCDATA()

endCDATA

void endCDATA()
              throws SAXException
Receive notification that the CDATA section finished.

Throws:
SAXException
See Also:
startCDATA()

fatalError

void fatalError(SAXParseException e)
                throws SAXException
Throws:
SAXException

error

void error(SAXParseException e)
           throws SAXException
Throws:
SAXException

warning

void warning(SAXParseException err)
             throws SAXException
Throws:
SAXException

startContentModel

void startContentModel(String elementName,
                       short contentModelType)
                       throws SAXException
receives notification that parsing of content model is beginning.

Parameters:
elementName - name of the element whose content model is going to be defined.
contentModelType - 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 elemen 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
Throws:
SAXException

endContentModel

void endContentModel(String elementName,
                     short contentModelType)
                     throws SAXException
receives notification that parsing of content model is finished.

Throws:
SAXException

attributeDecl

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.

Throws:
SAXException

childElement

void childElement(String elementName,
                  short occurence)
                  throws SAXException
Throws:
SAXException

mixedElement

void mixedElement(String elementName)
                  throws SAXException
receives notification of child element of mixed content model. this method is called for each child element.

Throws:
SAXException
See Also:
startContentModel(String, short)

startModelGroup

void startModelGroup()
                     throws SAXException
Throws:
SAXException

endModelGroup

void endModelGroup(short occurence)
                   throws SAXException
Throws:
SAXException

connector

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)

Throws:
SAXException