org.apache.xerces.framework
Interface XMLDocumentScanner.EventHandler

All Known Implementing Classes:
XMLParser
Enclosing class:
XMLDocumentScanner

public static interface XMLDocumentScanner.EventHandler

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


Method Summary
 void callCharacters(int ch)
          Report the scanning of character data
 void callComment(int data)
          Report the scanning of a comment
 void callEndDocument()
          Signal the end of a document
 boolean callEndElement(int readerId)
          signal the scanning of an end element tag
 void callProcessingInstruction(int piTarget, int piData)
          Report the scanning of a processing instruction
 void callStartDocument(int version, int encoding, int standalone)
          Signal the start of a document
 void callStartElement(int elementType)
          signal the scanning of a start element tag
 void endCDATA()
          Signal the end of a CDATA section
 int scanAttributeName(XMLEntityHandler.EntityReader entityReader, int elementType)
          Scan an attribute name.
 int scanAttValue(int elementType, int attrName)
          Scan the value of an attribute and include it in the set of specified attributes for the element.
 void scanDoctypeDecl(boolean standalone)
          Scan the document type declaration
 int scanElementType(XMLEntityHandler.EntityReader entityReader, char fastchar)
          Scan an element type.
 boolean scanExpectedElementType(XMLEntityHandler.EntityReader entityReader, char fastchar)
          Scan the expected element type.
 void startCDATA()
          Signal the start of a CDATA section
 boolean validEncName(java.lang.String encoding)
          Check for a valid encoding name
 boolean validVersionNum(java.lang.String version)
          Check for a valid XML version number
 

Method Detail

scanElementType

public int scanElementType(XMLEntityHandler.EntityReader entityReader,
                           char fastchar)
                    throws java.lang.Exception
Scan an element type. If namespaces are supported, this method should scan a QName instead of a Name and report any related well-formedness errors.
Parameters:
entityReader - The entity reader.
fastchar - A likely non-name character that might terminate the element type.
Returns:
The handle in the string pool for the element type scanned, or -1 if we were not able to scan an element type at the current location.
Throws:
java.lang.Exception -  

scanExpectedElementType

public boolean scanExpectedElementType(XMLEntityHandler.EntityReader entityReader,
                                       char fastchar)
                                throws java.lang.Exception
Scan the expected element type. This method is used to scan the matching end tag for the element type at the current nesting depth of the document.
Parameters:
entityReader - The entity reader.
fastchar - A likely non-name character that might terminate the element type.
Returns:
true if we scanned the expected element type; otherwise false if we were not able to scan an element type at the current location, or if that element type was not the one we expected to find.
Throws:
java.lang.Exception -  

scanAttributeName

public int scanAttributeName(XMLEntityHandler.EntityReader entityReader,
                             int elementType)
                      throws java.lang.Exception
Scan an attribute name. If namespaces are supported, this method should scan a QName instead of a Name and report any related well-formedness errors.
Parameters:
entityReader - The entity reader.
elementType - The element type for this attribute.
Returns:
The handle in the string pool for the attribute name scanned, or -1 if we were not able to scan an attribute name at the current location.
Throws:
java.lang.Exception -  

callStartDocument

public void callStartDocument(int version,
                              int encoding,
                              int standalone)
                       throws java.lang.Exception
Signal the start of a document
Parameters:
version - the handle in the string pool for the version number
encoding - the handle in the string pool for the encoding
standalong - the handle in the string pool for the standalone value
Throws:
java.lang.Exception -  

callEndDocument

public void callEndDocument()
                     throws java.lang.Exception
Signal the end of a document
Throws:
java.lang.Exception -  

callStartElement

public void callStartElement(int elementType)
                      throws java.lang.Exception
signal the scanning of a start element tag
Parameters:
elementType - handle to the elementType being scanned
Throws:
java.lang.Exception -  

callEndElement

public boolean callEndElement(int readerId)
                       throws java.lang.Exception
signal the scanning of an end element tag
Parameters:
readerId - the Id of the reader being used to scan the end tag.
Throws:
java.lang.Exception -  

validVersionNum

public boolean validVersionNum(java.lang.String version)
                        throws java.lang.Exception
Check for a valid XML version number
Parameters:
version - a string representing an XML version number
Returns:
true if the parser can process this version of XML
Throws:
java.lang.Exception -  

validEncName

public boolean validEncName(java.lang.String encoding)
                     throws java.lang.Exception
Check for a valid encoding name
Parameters:
encoding - a string containing an encoding naem
Returns:
true if the encoding name is valid
Throws:
java.lang.Exception -  

startCDATA

public void startCDATA()
                throws java.lang.Exception
Signal the start of a CDATA section
Throws:
java.lang.Exception -  

endCDATA

public void endCDATA()
              throws java.lang.Exception
Signal the end of a CDATA section
Throws:
java.lang.Exception -  

callCharacters

public void callCharacters(int ch)
                    throws java.lang.Exception
Report the scanning of character data
Parameters:
ch - the handle in the string pool of the character data that was scanned
Throws:
java.lang.Exception -  

callProcessingInstruction

public void callProcessingInstruction(int piTarget,
                                      int piData)
                               throws java.lang.Exception
Report the scanning of a processing instruction
Parameters:
piTarget - the handle in the string pool of the processing instruction targe
piData - the handle in the string pool of the processing instruction data
Throws:
java.lang.Exception -  

callComment

public void callComment(int data)
                 throws java.lang.Exception
Report the scanning of a comment
Parameters:
data - the handle in the string pool of the comment text
Throws:
java.lang.Exception -  

scanDoctypeDecl

public void scanDoctypeDecl(boolean standalone)
                     throws java.lang.Exception
Scan the document type declaration
Parameters:
standalone - true if there was a standalone document declaration in the XMLDecl
Throws:
java.lang.Exception -  

scanAttValue

public int scanAttValue(int elementType,
                        int attrName)
                 throws java.lang.Exception
Scan the value of an attribute and include it in the set of specified attributes for the element.
Parameters:
elementType - handle for the element type of the attribute.
attrName - handle for the attribute name.
Returns:
XMLDocumentScanner.RESULT_SUCCESS if the attribute was created, XMLDocumentScanner.RESULT_NOT_WELL_FORMED if the scan failed, or XMLDocumentScanner.RESULT_DUPLICATE_ATTR if the attribute is a duplicate.
Throws:
java.lang.Exception -  


Copyright © 1999 Apache XML Project. All Rights Reserved.