org.apache.xerces.framework
Interface XMLDTDScanner.EventHandler

All Known Implementing Classes:
DTDValidator
Enclosing class:
XMLDTDScanner

public static interface XMLDTDScanner.EventHandler

This interface must be implemented by the users of the XMLDTDScanner class. These methods form the abstraction between the implementation semantics and the more generic task of scanning the DTD-specific XML grammar.


Method Summary
 int addAttDef(int elementIndex, int attName, int attType, int enumeration, int attDefaultType, int attDefaultValue)
          Add an attribute definition
 int addContentSpecNode(int nodeType, int nodeValue)
          Create an XMLContentSpecNode for a single non-leaf
 int addContentSpecNode(int nodeType, int leftNodeIndex, int rightNodeIndex)
          Create an XMLContentSpecNode for a two child leaf
 int addElementDecl(int elementType)
          Add an element declaration (forward reference)
 int addElementDecl(int elementType, int contentSpecType, int contentSpec)
          Add an element declaration
 int addExternalEntityDecl(int name, int publicId, int systemId)
          Add a declaration for an entity
 int addExternalPEDecl(int name, int publicId, int systemId)
          Add a declaration for an external parameter entity
 int addInternalEntityDecl(int name, int value, int location)
          Add a declaration for an internal entity
 int addInternalPEDecl(int name, int value, int location)
          Add a declaration for an internal parameter entity
 void addNameToEnumeration(int enumIndex, int elementType, int attrName, int nameIndex, boolean isNotationType)
          Add a name to an enumeration
 int addNotationDecl(int notationName, int publicId, int systemId)
          Add a declaration for a notation
 int addUniqueLeafNode(int nameIndex)
          create an XMLContentSpecNode for a leaf
 int addUnparsedEntityDecl(int name, int publicId, int systemId, int notationName)
          Add a declaration for an unparsed entity
 void callComment(int data)
          Called when a comment has been scanned
 void callProcessingInstruction(int piTarget, int piData)
          Called when a processing instruction has been scanned
 int checkForAttributeNameWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastcheck)
          Scan for an attribute name at a point in the grammar where parameter entity references are allowed.
 int checkForElementTypeWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastchar)
          Scan for an element type at a point in the grammar where parameter entity references are allowed.
 int checkForNameWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastcheck)
          Scan for a Name at a point in the grammar where parameter entity references are allowed.
 int checkForNmtokenWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastcheck)
          Scan for a name token at a point in the grammar where parameter entity references are allowed.
 void doctypeDecl(int rootElementType, int publicId, int systemId)
          Called when the doctype decl is scanned
 void endEnumeration(int enumIndex)
          Finish processing an enumeration
 java.lang.String getContentSpecNodeAsString(int nodeIndex)
          Create a string representation of an XMLContentSpecNode tree
 void internalSubset(int internalSubset)
          Supports DOM Level 2 internalSubset additions.
 int saveCurrentLocation()
          REVISIT - does this really do anything -- can we kill it?
 int scanDefaultAttValue(int elementType, int attrName, int attType, int enumeration)
          Scan the default value for an attribute
 int scanElementType(XMLEntityHandler.EntityReader entityReader, char fastchar)
          Scan an element type
 int startEnumeration()
          Called when the scanner start scanning an enumeration
 void startReadingFromExternalSubset(int publicId, int systemId)
          Called when the DTDScanner starts reading from the external subset
 void stopReadingFromExternalSubset()
          Called when the DTDScanner stop reading from the external subset
 boolean validEncName(java.lang.String encoding)
          Determine whether a string is a valid encoding name
 int validPublicId(java.lang.String publicId)
          Determine if a string is a valid public identifier
 boolean validVersionNum(java.lang.String version)
          Determine whether a string is a valid XML version number
 

Method Detail

saveCurrentLocation

public int saveCurrentLocation()
                        throws java.lang.Exception
REVISIT - does this really do anything -- can we kill it?
Returns:
the current location
Throws:
java.lang.Exception -  

validVersionNum

public boolean validVersionNum(java.lang.String version)
                        throws java.lang.Exception
Determine whether a string is a valid XML version number
Parameters:
version - string to be checked
Returns:
true if version is a valid XML version number
Throws:
java.lang.Exception -  

validEncName

public boolean validEncName(java.lang.String encoding)
                     throws java.lang.Exception
Determine whether a string is a valid encoding name
Parameters:
encoding - string to be checked
Returns:
true if encoding is a valid encoding name
Throws:
java.lang.Exception -  

validPublicId

public int validPublicId(java.lang.String publicId)
                  throws java.lang.Exception
Determine if a string is a valid public identifier
Parameters:
publicId - string to be checked
Returns:
true if publicId is a valid public identifier
Throws:
java.lang.Exception -  

doctypeDecl

public void doctypeDecl(int rootElementType,
                        int publicId,
                        int systemId)
                 throws java.lang.Exception
Called when the doctype decl is scanned
Parameters:
rootElementType - handle of the rootElement
publicId - StringPool handle of the public id
systemId - StringPool handle of the system id
Throws:
java.lang.Exception -  

startReadingFromExternalSubset

public void startReadingFromExternalSubset(int publicId,
                                           int systemId)
                                    throws java.lang.Exception
Called when the DTDScanner starts reading from the external subset
Parameters:
publicId - StringPool handle of the public id
systemId - StringPool handle of the system id
Throws:
java.lang.Exception -  

stopReadingFromExternalSubset

public void stopReadingFromExternalSubset()
                                   throws java.lang.Exception
Called when the DTDScanner stop reading from the external subset
Throws:
java.lang.Exception -  

addElementDecl

public int addElementDecl(int elementType)
                   throws java.lang.Exception
Add an element declaration (forward reference)
Parameters:
handle - to the name of the element being declared
Returns:
handle to the element whose declaration was added
Throws:
java.lang.Exception -  

addElementDecl

public int addElementDecl(int elementType,
                          int contentSpecType,
                          int contentSpec)
                   throws java.lang.Exception
Add an element declaration
Parameters:
handle - to the name of the element being declared
contentSpecType - handle to the type name of the content spec
ContentSpec - handle to the content spec node for the contentSpecType
Returns:
handle to the element declaration that was added
Throws:
java.lang.Exception -  

addAttDef

public int addAttDef(int elementIndex,
                     int attName,
                     int attType,
                     int enumeration,
                     int attDefaultType,
                     int attDefaultValue)
              throws java.lang.Exception
Add an attribute definition
Parameters:
handle - to the element whose attribute is being declared
attName - StringPool handle to the attribute name being declared
attType - type of the attribute
enumeration - StringPool handle of the attribute's enumeration list (if any)
attDefaultType - an integer value denoting the DefaultDecl value
attDefaultValue - StringPool handle of this attribute's default value
Returns:
handle to the attribute definition
Throws:
java.lang.Exception -  

addUniqueLeafNode

public int addUniqueLeafNode(int nameIndex)
                      throws java.lang.Exception
create an XMLContentSpecNode for a leaf
Parameters:
nameIndex - StringPool handle to the name (Element) for the node
Returns:
handle to the newly create XMLContentSpecNode
Throws:
java.lang.Exception -  

addContentSpecNode

public int addContentSpecNode(int nodeType,
                              int nodeValue)
                       throws java.lang.Exception
Create an XMLContentSpecNode for a single non-leaf
Parameters:
nodeType - the type of XMLContentSpecNode to create - from XMLContentSpecNode.CONTENTSPECNODE_*
nodeValue - handle to an XMLContentSpecNode
Returns:
handle to the newly create XMLContentSpecNode
Throws:
java.lang.Exception -  

addContentSpecNode

public int addContentSpecNode(int nodeType,
                              int leftNodeIndex,
                              int rightNodeIndex)
                       throws java.lang.Exception
Create an XMLContentSpecNode for a two child leaf
Parameters:
nodeType - the type of XMLContentSpecNode to create - from XMLContentSpecNode.CONTENTSPECNODE_*
leftNodeIndex - handle to an XMLContentSpecNode
rightNodeIndex - handle to an XMLContentSpecNode
Returns:
handle to the newly create XMLContentSpecNode
Throws:
java.lang.Exception -  

getContentSpecNodeAsString

public java.lang.String getContentSpecNodeAsString(int nodeIndex)
                                            throws java.lang.Exception
Create a string representation of an XMLContentSpecNode tree
Parameters:
handle - to an XMLContentSpecNode
Returns:
String representation of the content spec tree
Throws:
java.lang.Exception -  

addInternalPEDecl

public int addInternalPEDecl(int name,
                             int value,
                             int location)
                      throws java.lang.Exception
Add a declaration for an internal parameter entity
Parameters:
name - StringPool handle of the parameter entity name
value - StringPool handle of the parameter entity value
location - location in the containing entity
Returns:
handle to the parameter entity declaration
Throws:
java.lang.Exception -  

addExternalPEDecl

public int addExternalPEDecl(int name,
                             int publicId,
                             int systemId)
                      throws java.lang.Exception
Add a declaration for an external parameter entity
Parameters:
name - StringPool handle of the parameter entity name
publicId - StringPool handle of the publicId
systemId - StringPool handle of the systemId
Returns:
handle to the parameter entity declaration
Throws:
java.lang.Exception -  

addInternalEntityDecl

public int addInternalEntityDecl(int name,
                                 int value,
                                 int location)
                          throws java.lang.Exception
Add a declaration for an internal entity
Parameters:
name - StringPool handle of the entity name
value - StringPool handle of the entity value
location - location in the containing entity
Returns:
handle to the entity declaration
Throws:
java.lang.Exception -  

addExternalEntityDecl

public int addExternalEntityDecl(int name,
                                 int publicId,
                                 int systemId)
                          throws java.lang.Exception
Add a declaration for an entity
Parameters:
name - StringPool handle of the entity name
publicId - StringPool handle of the publicId
systemId - StringPool handle of the systemId
Returns:
handle to the entity declaration
Throws:
java.lang.Exception -  

addUnparsedEntityDecl

public int addUnparsedEntityDecl(int name,
                                 int publicId,
                                 int systemId,
                                 int notationName)
                          throws java.lang.Exception
Add a declaration for an unparsed entity
Parameters:
name - StringPool handle of the entity name
publicId - StringPool handle of the publicId
systemId - StringPool handle of the systemId
notationName - StringPool handle of the notationName
Returns:
handle to the entity declaration
Throws:
java.lang.Exception -  

startEnumeration

public int startEnumeration()
                     throws java.lang.Exception
Called when the scanner start scanning an enumeration
Returns:
StringPool handle to a string list that will hold the enumeration names
Throws:
java.lang.Exception -  

addNameToEnumeration

public void addNameToEnumeration(int enumIndex,
                                 int elementType,
                                 int attrName,
                                 int nameIndex,
                                 boolean isNotationType)
                          throws java.lang.Exception
Add a name to an enumeration
Parameters:
enumIndex - StringPool handle to the string list for the enumeration
elementType - handle to the element that owns the attribute with the enumeration
attrName - StringPool handle to the name of the attribut with the enumeration
nameIndex - StringPool handle to the name to be added to the enumeration
isNotationType - true if the enumeration is an enumeration of NOTATION names
Throws:
java.lang.Exception -  

endEnumeration

public void endEnumeration(int enumIndex)
                    throws java.lang.Exception
Finish processing an enumeration
Parameters:
enumIndex - handle to the string list which holds the enumeration to be finshed.
Throws:
java.lang.Exception -  

addNotationDecl

public int addNotationDecl(int notationName,
                           int publicId,
                           int systemId)
                    throws java.lang.Exception
Add a declaration for a notation
Parameters:
notationName -  
publicId -  
systemId -  
Returns:
handle to the notation declaration
Throws:
java.lang.Exception -  

callComment

public void callComment(int data)
                 throws java.lang.Exception
Called when a comment has been scanned
Parameters:
data - StringPool handle of the comment text
Throws:
java.lang.Exception -  

callProcessingInstruction

public void callProcessingInstruction(int piTarget,
                                      int piData)
                               throws java.lang.Exception
Called when a processing instruction has been scanned
Parameters:
piTarget - StringPool handle of the PI target
piData - StringPool handle of the PI data
Throws:
java.lang.Exception -  

scanElementType

public int scanElementType(XMLEntityHandler.EntityReader entityReader,
                           char fastchar)
                    throws java.lang.Exception
Scan an element type
Parameters:
entityReader - reader to read from
fastchar - hint - character likely to terminate the element type
Returns:
StringPool handle for the element type
Throws:
java.lang.Exception -  

checkForElementTypeWithPEReference

public int checkForElementTypeWithPEReference(XMLEntityHandler.EntityReader entityReader,
                                              char fastchar)
                                       throws java.lang.Exception
Scan for an element type at a point in the grammar where parameter entity references are allowed. If such a reference is encountered, the replacement text will be scanned, skipping any white space that may be found, expanding references in this manner until an element type is scanned, or we fail to find one.
Parameters:
entityReader - reader to read from
fastchar - hint - character likely to terminate the element type
Returns:
StringPool handle for the element type
Throws:
java.lang.Exception -  

checkForAttributeNameWithPEReference

public int checkForAttributeNameWithPEReference(XMLEntityHandler.EntityReader entityReader,
                                                char fastcheck)
                                         throws java.lang.Exception
Scan for an attribute name at a point in the grammar where parameter entity references are allowed. If such a reference is encountered, the replacement text will be scanned, skipping any white space that may be found, expanding references in this manner until an attribute name is scanned, or we fail to find one.
Parameters:
entityReader - reader to read from
fastchar - hint - character likely to terminate the attribute name
Returns:
StringPool handle for the attribute name
Throws:
java.lang.Exception -  

checkForNameWithPEReference

public int checkForNameWithPEReference(XMLEntityHandler.EntityReader entityReader,
                                       char fastcheck)
                                throws java.lang.Exception
Scan for a Name at a point in the grammar where parameter entity references are allowed. If such a reference is encountered, the replacement text will be scanned, skipping any white space that may be found, expanding references in this manner until a name is scanned, or we fail to find one.
Parameters:
entityReader - reader to read from
fastcheck - hint - character likely to terminate the name
Returns:
StringPool handle for the name
Throws:
java.lang.Exception -  

checkForNmtokenWithPEReference

public int checkForNmtokenWithPEReference(XMLEntityHandler.EntityReader entityReader,
                                          char fastcheck)
                                   throws java.lang.Exception
Scan for a name token at a point in the grammar where parameter entity references are allowed. If such a reference is encountered, the replacement text will be scanned, skipping any white space that may be found, expanding references in this manner until a name token is scanned, or we fail to find one.
Parameters:
entityReader - reader to read from
fastcheck - hint - character likely to terminate the name token
Returns:
StringPool handle for the name token
Throws:
java.lang.Exception -  

scanDefaultAttValue

public int scanDefaultAttValue(int elementType,
                               int attrName,
                               int attType,
                               int enumeration)
                        throws java.lang.Exception
Scan the default value for an attribute
Parameters:
elementType - handle to the element type that owns the attribute
attrName - StringPool handle to the name of the attribute
attType - the attribute type
enumeration - StringPool handle to a string list containing enumeration values
Returns:
StringPool handle to the default value
Throws:
java.lang.Exception -  

internalSubset

public void internalSubset(int internalSubset)
Supports DOM Level 2 internalSubset additions. Called when the internal subset is completely scanned.


Copyright © 1999 Apache XML Project. All Rights Reserved.