Xerces 1.0.0

org.apache.xerces.parsers
Class SAXParser

java.lang.Object
  |
  +--org.apache.xerces.framework.XMLParser
        |
        +--org.apache.xerces.parsers.SAXParser

public class SAXParser
extends XMLParser
implements Parser

SAXParser provides a parser which implements the SAX1 and SAX2 parser APIs

Version:
 

Fields inherited from class org.apache.xerces.framework.XMLParser
fCurrentElementEntity, fCurrentElementType, fDTDValidator, fElementDepth, fEntityHandler, fErrorReporter, fInElementContent, fNamespacesEnabled, fNamespaceSep, fParseInProgress, fReaderFactory, fScanner, fSchemaValidator, fStringPool, fValidator, SAX2_FEATURES_PREFIX, SAX2_HANDLERS_PREFIX, SAX2_PROPERTIES_PREFIX, XERCES_FEATURES_PREFIX, XERCES_PROPERTIES_PREFIX
 
Constructor Summary
SAXParser()
          Default constructor.
 
Method Summary
 void attlistDecl(int elementTypeIndex, int attrNameIndex, int attType, java.lang.String enumString, int attDefaultType, int attDefaultValue)
          Report an attribute type declaration.
 void characters(char[] ch, int start, int length)
          Characters.
 void characters(int dataIndex)
          Not called.
 void comment(int dataIndex)
          Comment.
 void commentInDTD(int dataIndex)
          Callback for comment in DTD.
 void elementDecl(int elementType, XMLValidator.ContentSpec contentSpec)
          Report an element type declaration.
 void endCDATA()
          End CDATA section.
 void endDocument()
          End document.
 void endDTD()
          This function will be called at the end of the DTD.
 void endElement(int elementType)
          End element.
 void endEntityReference(int entityName, int entityType, int entityContext)
          End entity reference.
 void endNamespaceDeclScope(int prefix)
          Report the end of the scope of a namespace declaration.
 void externalEntityDecl(int entityName, int publicId, int systemId)
          Report a parsed external general entity declaration.
 void externalPEDecl(int entityName, int publicId, int systemId)
          Report a parsed external parameter entity declaration.
protected  org.xml.sax.misc.DeclHandler getDeclHandler()
          Returns the DTD declaration event handler.
 boolean getFeature(java.lang.String featureId)
          Query the state of a feature.
 java.lang.String[] getFeaturesRecognized()
          Returns a list of features that this parser recognizes.
protected  org.xml.sax.misc.LexicalHandler getLexicalHandler()
          Returns the lexical handler.
protected  org.xml.sax.misc.NamespaceHandler getNamespaceHandler()
          Returns the namespace declaration scope event handler.
protected  boolean getNormalizeText()
          Note: This feature is always false.
 java.lang.String[] getPropertiesRecognized()
          Returns a list of properties that this parser recognizes.
 java.lang.Object getProperty(java.lang.String propertyId)
          Query the value of a property.
protected  boolean getUseLocator()
          Note: This feature is always true.
 void ignorableWhitespace(char[] ch, int start, int length)
          Ignorable whitespace.
 void ignorableWhitespace(int dataIndex)
          Not called.
 void internalEntityDecl(int entityName, int entityValue)
          Report an internal general entity declaration.
 void internalPEDecl(int entityName, int entityValue)
          Report an internal parameter entity declaration.
 void notationDecl(int notationName, int publicId, int systemId)
          Receive notification of a notation declaration event.
 void processingInstruction(int piTarget, int piData)
          Processing instruction.
 void processingInstructionInDTD(int piTarget, int piData)
          Callback for processing instruction in DTD.
protected  void setDeclHandler(org.xml.sax.misc.DeclHandler handler)
          Set the DTD declaration event handler.
 void setDocumentHandler(DocumentHandler handler)
          Sets the document handler.
 void setDTDHandler(DTDHandler handler)
          Sets the DTD handler.
 void setFeature(java.lang.String featureId, boolean state)
          Set the state of any feature in a SAX2 parser.
protected  void setLexicalHandler(org.xml.sax.misc.LexicalHandler handler)
          Set the lexical event handler.
protected  void setNamespaceHandler(org.xml.sax.misc.NamespaceHandler handler)
          Set the namespace declaration scope event handler.
protected  void setNormalizeText(boolean normalize)
          Note: Currently, the parser does not support this feature. Setting this feature to true will throw a SAXNotSupportedException.
 void setProperty(java.lang.String propertyId, java.lang.Object value)
          Set the value of any property in a SAX2 parser.
protected  void setUseLocator(boolean use)
          Note: Currently, this parser always sets the locator. Setting this feature to false will throw a SAXNotSupportedException.
 void startCDATA()
          Start CDATA section.
 void startDocument(int versionIndex, int encodingIndex, int standaloneIndex)
          Start document.
 void startDTD(int rootElementType, int publicId, int systemId)
          This function will be called when a <!DOCTYPE...> declaration is encountered.
 void startElement(int elementType, XMLAttrList attrList, int attrListIndex)
          Start element
 void startEntityReference(int entityName, int entityType, int entityContext)
          Start entity reference.
 void startNamespaceDeclScope(int prefix, int uri)
          Report the start of the scope of a namespace declaration.
 void unparsedEntityDecl(int entityName, int publicId, int systemId, int notationName)
          Receive notification of an unparsed entity declaration event.
 
Methods inherited from class org.apache.xerces.framework.XMLParser
addRecognizer, callCharacters, callComment, callEndDocument, callEndElement, callProcessingInstruction, callStartDocument, callStartElement, changeReaders, endEntityDecl, expandSystemId, getAllowJavaEncodings, getColumnNumber, getContinueAfterFatalError, getEntityReader, getExternalGeneralEntities, getExternalParameterEntities, getLineNumber, getLocator, getNamespaces, getNamespaceSep, getPublicId, getReaderDepth, getReaderId, getSchemaValidator, getSystemId, getValidation, getValidationDynamic, getValidationWarnOnDuplicateAttdef, getValidationWarnOnUndeclaredElemdef, getXMLString, isFeatureRecognized, isPropertyRecognized, parse, parse, parseSome, parseSomeSetup, processCharacters, processCharacters, processWhitespace, processWhitespace, reportError, reset, resetOrCopy, scanAttributeName, scanAttValue, scanDoctypeDecl, scanElementType, scanExpectedElementType, setAllowJavaEncodings, setContinueAfterFatalError, setEntityResolver, setErrorHandler, setExternalGeneralEntities, setExternalParameterEntities, setLocale, setLocator, setNamespaces, setNamespaceSep, setReaderDepth, setSendCharDataAsCharArray, setValidating, setValidation, setValidationDynamic, setValidationWarnOnDuplicateAttdef, setValidationWarnOnUndeclaredElemdef, startEntityDecl, startReadingFromDocument, startReadingFromEntity, startReadingFromExternalSubset, stopReadingFromExternalSubset, validEncName, validVersionNum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXParser

public SAXParser()
Default constructor.
Method Detail

getFeaturesRecognized

public java.lang.String[] getFeaturesRecognized()
Returns a list of features that this parser recognizes. This method will never return null; if no features are recognized, this method will return a zero length array.
Overrides:
getFeaturesRecognized in class XMLParser
See Also:
XMLParser.isFeatureRecognized(java.lang.String), setFeature(java.lang.String, boolean), getFeature(java.lang.String)

getPropertiesRecognized

public java.lang.String[] getPropertiesRecognized()
Returns a list of properties that this parser recognizes. This method will never return null; if no properties are recognized, this method will return a zero length array.
Overrides:
getPropertiesRecognized in class XMLParser
See Also:
XMLParser.isPropertyRecognized(java.lang.String), setProperty(java.lang.String, java.lang.Object), getProperty(java.lang.String)

setNormalizeText

protected void setNormalizeText(boolean normalize)
                         throws SAXException
Note: Currently, the parser does not support this feature. Setting this feature to true will throw a SAXNotSupportedException.

Ensures that all consecutive text is returned in a single callback to the DocumentHandler.characters or DocumentHandler.ignorableWhitespace methods.

This method is the equivalent to the feature:

 http://xml.org/sax/features/normalize-text
 
Parameters:
normalize - True to normalize; false not to normalize.
See Also:
getNormalizeText(), setFeature(java.lang.String, boolean)

getNormalizeText

protected boolean getNormalizeText()
                            throws SAXException
Note: This feature is always false.

Returns true if the parser normalizes all consecutive text into a single callback to the DocumentHandler.characters or DocumentHandler.ignorableWhitespace methods.

See Also:
setNormalizeText(boolean)

setUseLocator

protected void setUseLocator(boolean use)
                      throws SAXException
Note: Currently, this parser always sets the locator. Setting this feature to false will throw a SAXNotSupportedException.

Provide a Locator using the DocumentHandler.setDocumentLocator callback (true), or explicitly do not provide one (false).

This method is the equivalent to the feature:

 http://xml.org/sax/features/use-locator
 
See Also:
getUseLocator(), setFeature(java.lang.String, boolean)

getUseLocator

protected boolean getUseLocator()
                         throws SAXException
Note: This feature is always true.

Returns true if the locator is always set.

See Also:
setUseLocator(boolean)

setDeclHandler

protected void setDeclHandler(org.xml.sax.misc.DeclHandler handler)
                       throws SAXException
Set the DTD declaration event handler.

This method is the equivalent to the property:

 http://xml.org/sax/handlers/DeclHandler
 
Parameters:
handler - The new handler.
See Also:
getDeclHandler(), setProperty(java.lang.String, java.lang.Object)

getDeclHandler

protected org.xml.sax.misc.DeclHandler getDeclHandler()
                                               throws SAXException
Returns the DTD declaration event handler.
See Also:
setDeclHandler(org.xml.sax.misc.DeclHandler)

setLexicalHandler

protected void setLexicalHandler(org.xml.sax.misc.LexicalHandler handler)
                          throws SAXException
Set the lexical event handler.

This method is the equivalent to the property:

 http://xml.org/sax/handlers/LexicalHandler
 
Parameters:
handler - lexical event handler
See Also:
getLexicalHandler(), setProperty(java.lang.String, java.lang.Object)

getLexicalHandler

protected org.xml.sax.misc.LexicalHandler getLexicalHandler()
                                                     throws SAXException
Returns the lexical handler.
See Also:
setLexicalHandler(org.xml.sax.misc.LexicalHandler)

setNamespaceHandler

protected void setNamespaceHandler(org.xml.sax.misc.NamespaceHandler handler)
                            throws SAXException
Set the namespace declaration scope event handler.

This method is the equivalent to the property:

 http://xml.org/sax/handlers/NamespaceHandler
 
Parameters:
handler - namespace event handler
See Also:
getNamespaceHandler(), setProperty(java.lang.String, java.lang.Object)

getNamespaceHandler

protected org.xml.sax.misc.NamespaceHandler getNamespaceHandler()
                                                         throws SAXException
Returns the namespace declaration scope event handler.
See Also:
setNamespaceHandler(org.xml.sax.misc.NamespaceHandler)

setFeature

public void setFeature(java.lang.String featureId,
                       boolean state)
                throws SAXException
Set the state of any feature in a SAX2 parser. The parser might not recognize the feature, and if it does recognize it, it might not be able to fulfill the request.
Overrides:
setFeature in class XMLParser
Parameters:
featureId - The unique identifier (URI) of the feature.
state - The requested state of the feature (true or false).
Throws:
SAXNotRecognizedException - If the requested feature is not known.
SAXNotSupportedException - If the requested feature is known, but the requested state is not supported.
SAXException - If there is any other problem fulfilling the request.

getFeature

public boolean getFeature(java.lang.String featureId)
                   throws SAXException
Query the state of a feature. Query the current state of any feature in a SAX2 parser. The parser might not recognize the feature.
Overrides:
getFeature in class XMLParser
Parameters:
featureId - The unique identifier (URI) of the feature being set.
Returns:
The current state of the feature.
Throws:
SAXNotRecognizedException - If the requested feature is not known.
SAXException - If there is any other problem fulfilling the request.

setProperty

public void setProperty(java.lang.String propertyId,
                        java.lang.Object value)
                 throws SAXException
Set the value of any property in a SAX2 parser. The parser might not recognize the property, and if it does recognize it, it might not support the requested value.
Overrides:
setProperty in class XMLParser
Parameters:
propertyId - The unique identifier (URI) of the property being set.
Object - The value to which the property is being set.
Throws:
SAXNotRecognizedException - If the requested property is not known.
SAXNotSupportedException - If the requested property is known, but the requested value is not supported.
SAXException - If there is any other problem fulfilling the request.

getProperty

public java.lang.Object getProperty(java.lang.String propertyId)
                             throws SAXException
Query the value of a property. Return the current value of a property in a SAX2 parser. The parser might not recognize the property.
Overrides:
getProperty in class XMLParser
Parameters:
propertyId - The unique identifier (URI) of the property being set.
Returns:
The current value of the property.
Throws:
SAXNotRecognizedException - If the requested property is not known.
SAXException - If there is any other problem fulfilling the request.
See Also:
Configurable.getProperty(java.lang.String)

setDTDHandler

public void setDTDHandler(DTDHandler handler)
Sets the DTD handler.
Specified by:
setDTDHandler in interface Parser
Tags copied from interface: Parser
Parameters:
handler - The DTD handler.
See Also:
DTDHandler, HandlerBase

setDocumentHandler

public void setDocumentHandler(DocumentHandler handler)
Sets the document handler.
Specified by:
setDocumentHandler in interface Parser
Tags copied from interface: Parser
Parameters:
handler - The document handler.
See Also:
DocumentHandler, HandlerBase

startDTD

public void startDTD(int rootElementType,
                     int publicId,
                     int systemId)
              throws java.lang.Exception
This function will be called when a <!DOCTYPE...> declaration is encountered.
Overrides:
startDTD in class XMLParser
Tags copied from class: XMLParser
Parameters:
rootElementType - element handle for the root element of the document
publicId - string pool index of the DTD's public ID
systemId - string pool index of the DTD's system ID
Throws:
java.lang.Exception -  

endDTD

public void endDTD()
            throws java.lang.Exception
This function will be called at the end of the DTD.
Overrides:
endDTD in class XMLParser

elementDecl

public void elementDecl(int elementType,
                        XMLValidator.ContentSpec contentSpec)
                 throws java.lang.Exception
Report an element type declaration. The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator. The model will be normalized so that all whitespace is removed.
Overrides:
elementDecl in class XMLParser
Parameters:
name - The element type name.
model - The content model as a normalized string.
Throws:
SAXException - The application may raise an exception.

attlistDecl

public void attlistDecl(int elementTypeIndex,
                        int attrNameIndex,
                        int attType,
                        java.lang.String enumString,
                        int attDefaultType,
                        int attDefaultValue)
                 throws java.lang.Exception
Report an attribute type declaration. Only the effective (first) declaration for an attribute will be reported. The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION", or a parenthesized token group with the separator "|" and all whitespace removed.
Overrides:
attlistDecl in class XMLParser
Parameters:
eName - The name of the associated element.
aName - The name of the attribute.
type - A string representing the attribute type.
valueDefault - A string representing the attribute default ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies.
value - A string representing the attribute's default value, or null if there is none.
Throws:
SAXException - The application may raise an exception.

internalPEDecl

public void internalPEDecl(int entityName,
                           int entityValue)
                    throws java.lang.Exception
Report an internal parameter entity declaration.
Overrides:
internalPEDecl in class XMLParser
Tags copied from class: XMLParser
Parameters:
entityName - string pool index of the entity name
entityValue - string pool index of the entity replacement text
Throws:
java.lang.Exception -  

externalPEDecl

public void externalPEDecl(int entityName,
                           int publicId,
                           int systemId)
                    throws java.lang.Exception
Report a parsed external parameter entity declaration.
Overrides:
externalPEDecl in class XMLParser
Tags copied from class: XMLParser
Parameters:
entityName - string pool index of the entity name
publicId - string pool index of the entity's public id.
systemId - string pool index of the entity's system id.
Throws:
java.lang.Exception -  

internalEntityDecl

public void internalEntityDecl(int entityName,
                               int entityValue)
                        throws java.lang.Exception
Report an internal general entity declaration.
Overrides:
internalEntityDecl in class XMLParser
Tags copied from class: XMLParser
Parameters:
entityName - string pool index of the entity name
entityValue - string pool index of the entity replacement text
Throws:
java.lang.Exception -  

externalEntityDecl

public void externalEntityDecl(int entityName,
                               int publicId,
                               int systemId)
                        throws java.lang.Exception
Report a parsed external general entity declaration.
Overrides:
externalEntityDecl in class XMLParser
Tags copied from class: XMLParser
Parameters:
entityName - string pool index of the entity name
publicId - string pool index of the entity's public id.
systemId - string pool index of the entity's system id.
Throws:
java.lang.Exception -  

unparsedEntityDecl

public void unparsedEntityDecl(int entityName,
                               int publicId,
                               int systemId,
                               int notationName)
                        throws java.lang.Exception
Receive notification of an unparsed entity declaration event.
Overrides:
unparsedEntityDecl in class XMLParser
Tags copied from class: XMLParser
Parameters:
entityName - string pool index of the entity name
publicId - string pool index of the entity's public id.
systemId - string pool index of the entity's system id.
notationName - string pool index of the notation name.
Throws:
java.lang.Exception -  

notationDecl

public void notationDecl(int notationName,
                         int publicId,
                         int systemId)
                  throws java.lang.Exception
Receive notification of a notation declaration event.
Overrides:
notationDecl in class XMLParser
Tags copied from class: XMLParser
Parameters:
notationName - string pool index of the notation name
publicId - string pool index of the notation's public id.
systemId - string pool index of the notation's system id.
Throws:
java.lang.Exception -  

startDocument

public void startDocument(int versionIndex,
                          int encodingIndex,
                          int standaloneIndex)
                   throws java.lang.Exception
Start document.
Overrides:
startDocument in class XMLParser
Tags copied from class: XMLParser
Parameters:
version - string pool index of the version attribute's value
encoding - string pool index of the encoding attribute's value
standAlone - string pool index of the standalone attribute's value
Throws:
java.lang.Exception -  

endDocument

public void endDocument()
                 throws java.lang.Exception
End document.
Overrides:
endDocument in class XMLParser
Tags copied from class: XMLParser
Throws:
java.lang.Exception -  

startNamespaceDeclScope

public void startNamespaceDeclScope(int prefix,
                                    int uri)
                             throws java.lang.Exception
Report the start of the scope of a namespace declaration.
Overrides:
startNamespaceDeclScope in class XMLParser
Tags copied from class: XMLParser
Parameters:
prefix - string pool index of the namespace prefix being declared
uri - string pool index of the namespace uri begin bound
java.lang.Exception -  

endNamespaceDeclScope

public void endNamespaceDeclScope(int prefix)
                           throws java.lang.Exception
Report the end of the scope of a namespace declaration.
Overrides:
endNamespaceDeclScope in class XMLParser
Tags copied from class: XMLParser
Parameters:
prefix - string pool index of the namespace prefix being declared
Throws:
java.lang.Exception -  

startElement

public void startElement(int elementType,
                         XMLAttrList attrList,
                         int attrListIndex)
                  throws java.lang.Exception
Start element
Overrides:
startElement in class XMLParser
Tags copied from class: XMLParser
Parameters:
elementType - element handle for the element being scanned
attrList - attrList containing the attributes of the element
attrListHandle - handle into attrList. Allows attributes to be retreived.
Throws:
java.lang.Exception -  

endElement

public void endElement(int elementType)
                throws java.lang.Exception
End element.
Overrides:
endElement in class XMLParser
Tags copied from class: XMLParser
Parameters:
elementType - element handle for the element being scanned
Throws:
java.lang.Exception -  

startEntityReference

public void startEntityReference(int entityName,
                                 int entityType,
                                 int entityContext)
                          throws java.lang.Exception
Start entity reference.
Overrides:
startEntityReference in class XMLParser
Tags copied from class: XMLParser
Parameters:
entityName - string pool index of the entity name
entityType - the XMLEntityHandler.ENTITYTYPE_* type
entityContext - the XMLEntityHandler.CONTEXT_* type for where the entity reference appears
Throws:
java.lang.Exception -  
See Also:
XMLEntityHandler, XMLEntityHandler

endEntityReference

public void endEntityReference(int entityName,
                               int entityType,
                               int entityContext)
                        throws java.lang.Exception
End entity reference.
Overrides:
endEntityReference in class XMLParser
Tags copied from class: XMLParser
Parameters:
entityName - string pool index of the entity anem
entityType - the XMLEntityHandler.ENTITYTYPE_* type
entityContext - the XMLEntityHandler.CONTEXT_* type for where the entity reference appears
Throws:
java.lang.Exception -  
See Also:
XMLEntityHandler, XMLEntityHandler

startCDATA

public void startCDATA()
                throws java.lang.Exception
Start CDATA section.
Overrides:
startCDATA in class XMLParser
Tags copied from class: XMLParser
Throws:
java.lang.Exception -  

endCDATA

public void endCDATA()
              throws java.lang.Exception
End CDATA section.
Overrides:
endCDATA in class XMLParser
Tags copied from class: XMLParser
Throws:
java.lang.Exception -  

characters

public void characters(int dataIndex)
                throws java.lang.Exception
Not called.
Overrides:
characters in class XMLParser
Tags copied from class: XMLParser
Parameters:
data - string pool index of the characters that were scanned
Throws:
java.lang.Exception -  

ignorableWhitespace

public void ignorableWhitespace(int dataIndex)
                         throws java.lang.Exception
Not called.
Overrides:
ignorableWhitespace in class XMLParser
Tags copied from class: XMLParser
Parameters:
data - string pool index of ignorable whitespace
Throws:
java.lang.Exception -  

processingInstruction

public void processingInstruction(int piTarget,
                                  int piData)
                           throws java.lang.Exception
Processing instruction.
Overrides:
processingInstruction in class XMLParser
Tags copied from class: XMLParser
Parameters:
target - string pool index of the PI target
data - string pool index of the PI data
Throws:
java.lang.Exception -  

processingInstructionInDTD

public void processingInstructionInDTD(int piTarget,
                                       int piData)
                                throws java.lang.Exception
Description copied from class: XMLParser
Callback for processing instruction in DTD.
Overrides:
processingInstructionInDTD in class XMLParser
Tags copied from class: XMLParser
Parameters:
target - the string pool index of the PI's target
data - the string pool index of the PI's data
Throws:
java.lang.Exception -  

comment

public void comment(int dataIndex)
             throws java.lang.Exception
Comment.
Overrides:
comment in class XMLParser
Tags copied from class: XMLParser
Parameters:
comment - string pool index of the comment text
Throws:
java.lang.Exception -  

commentInDTD

public void commentInDTD(int dataIndex)
                  throws java.lang.Exception
Description copied from class: XMLParser
Callback for comment in DTD.
Overrides:
commentInDTD in class XMLParser
Tags copied from class: XMLParser
Parameters:
comment - the string pool index of the comment text
Throws:
java.lang.Exception -  

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws java.lang.Exception
Characters.
Overrides:
characters in class XMLParser
Tags copied from class: XMLParser
Parameters:
ch - character array containing the characters that were scanned
start - offset in ch where scanned characters begin
length - length of scanned characters in ch
Throws:
java.lang.Exception -  

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws java.lang.Exception
Ignorable whitespace.
Overrides:
ignorableWhitespace in class XMLParser
Tags copied from class: XMLParser
Parameters:
ch - character array containing the whitespace that was scanned
start - offset in ch where scanned whitespace begins
length - length of scanned whitespace in ch
Throws:
java.lang.Exception -  

Xerces 1.0.0