Google

Xerces 3.1.1 API: Class SAXParser
Xerces 3.1.1

org.apache.xerces.parsers
Class SAXParser

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

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

Version:
$Id: SAXParser.java,v 1.16 2000/06/28 21:00:10 andyc Exp $

Inner classes inherited from class org.apache.xerces.framework.XMLDocumentHandler
XMLDocumentHandler.DTDHandler
 
Fields inherited from class org.apache.xerces.framework.XMLParser
fEntityHandler, fErrorReporter, fGrammarResolver, fParseInProgress, fScanner, fStringPool, fValidator, SAX2_FEATURES_PREFIX, SAX2_PROPERTIES_PREFIX, XERCES_FEATURES_PREFIX, XERCES_PROPERTIES_PREFIX
 
Constructor Summary
SAXParser()
          Default constructor.
 
          Allow an application to register a content event handler.
          Set the DTD declaration event handler.
          Sets the document handler.
          Allow an application to register a DTD event handler.
          Set the lexical event handler. int encodingIndex, int standaloneIndex)
          XML declaration.
Method Summary
 void attlistDecl(org.apache.xerces.utils.QName elementDecl, org.apache.xerces.utils.QName attributeDecl, int attType, boolean attList, 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 elementDecl(org.apache.xerces.utils.QName elementDecl, int contentSpecType, int contentSpecIndex, XMLContentSpec.Provider contentSpecProvider)
          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(org.apache.xerces.utils.QName element)
          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.
getContentHandler()
          Return the current content handler.
getDeclHandler()
          Returns the DTD declaration event handler.
getDTDHandler()
          Return the current DTD 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.
getLexicalHandler()
          Returns the lexical handler.
protected  boolean getNamespacePrefixes()
value.
 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.
 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 internalSubset(int internalSubset)
          New callback from DOM Level 2.
 void notationDecl(int notationName, int publicId, int systemId)
          Receive notification of a notation declaration event.
 void processingInstruction(int piTarget, int piData)
          Processing instruction.
 void
protected  void
 void
 void
 void setFeature(java.lang.String featureId, boolean state)
          Set the state of any feature in a SAX2 parser.
protected  void
protected  void setNamespacePrefixes(boolean process)
          Sets how the parser reports raw prefixed names,
 void setProperty(java.lang.String propertyId, java.lang.Object value)
          Set the value of any property in a SAX2 parser.
 void startCDATA()
          Start CDATA section.
 void startDocument()
          Start document.
 void startDTD(org.apache.xerces.utils.QName rootElement, int publicId, int systemId)
          This function will be called when a <!DOCTYPE...> declaration is encountered.
 void startElement(org.apache.xerces.utils.QName element, 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 textDecl(int versionIndex, int encodingIndex)
          Text declaration.
 void unparsedEntityDecl(int entityName, int publicId, int systemId, int notationName)
          Receive notification of an unparsed entity declaration event.
 void
 
Methods inherited from class org.apache.xerces.framework.XMLParser
addRecognizer, getAllowJavaEncodings, getContinueAfterFatalError, getEntityResolver, getErrorHandler, getExternalGeneralEntities, getExternalParameterEntities, getLoadDTDGrammar, getLocator, getNamespaces, getValidation, getValidationDynamic, getValidationSchema, getValidationWarnOnDuplicateAttdef, getValidationWarnOnUndeclaredElemdef, getXMLString, initHandlers, isFeatureRecognized, isPropertyRecognized, parse, parseSome, reset, resetOrCopy, setAllowJavaEncodings, setContinueAfterFatalError, setExternalGeneralEntities, setExternalParameterEntities, setLoadDTDGrammar, setLocale, setNamespaces, setNormalizeAttributeValues, setReaderFactory, setValidation, setValidationDynamic, setValidationSchema, setValidationWarnOnDuplicateAttdef, setValidationWarnOnUndeclaredElemdef
 
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)

setDeclHandler
Set the DTD declaration event handler.

This method is the equivalent to the property:

 
Parameters:
handler - The new handler.
See Also:
getDeclHandler(), setProperty(java.lang.String, java.lang.Object)

getDeclHandler

Returns the DTD declaration event handler.

setLexicalHandler
Set the lexical event handler.

This method is the equivalent to the property:

 
Parameters:
handler - lexical event handler
See Also:
getLexicalHandler(), setProperty(java.lang.String, java.lang.Object)

getLexicalHandler

Returns the lexical handler.

setDocumentHandler
Sets the document handler.

setDTDHandler
Allow an application to register a DTD event handler.

If the application does not register a DTD handler, all DTD events reported by the SAX parser will be silently ignored.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

Parameters:
handler - The DTD handler.
Throws:
java.lang.NullPointerException - If the handler argument is null.
See Also:
getDTDHandler()

getDTDHandler

Return the current DTD handler.
Returns:
The current DTD handler, or null if none

setNamespacePrefixes

protected void setNamespacePrefixes(boolean process)
Sets how the parser reports raw prefixed names,

This method is the equivalent to the feature:

 
Parameters:
process - True to process namespaces; false to not process.
See Also:
XMLParser.getNamespaces(), setFeature(java.lang.String, boolean)

getNamespacePrefixes

protected boolean getNamespacePrefixes()
value.
See Also:
setNamespacePrefixes(boolean)

setFeature

public void setFeature(java.lang.String featureId,
                       boolean state)
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.
requested feature is known, but the requested state is not supported.

getFeature

public boolean getFeature(java.lang.String featureId)
Query the state of a feature. Query the current state of any feature in a SAX2 parser. The parser might not recognize the feature.
Parameters:
featureId - The unique identifier (URI) of the feature requested feature is known but not supported.

setProperty

public void setProperty(java.lang.String propertyId,
                        java.lang.Object value)
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.
Parameters:
propertyId - The unique identifier (URI) of the property requested property is known, but the requested value is not supported.

getProperty

public java.lang.Object getProperty(java.lang.String propertyId)
Query the value of a property. Return the current value of a property in a SAX2 parser. The parser might not recognize the property.
Parameters:
propertyId - The unique identifier (URI) of the property requested property is known but not supported.

setContentHandler
Allow an application to register a content event handler.

If the application does not register a content handler, all content events reported by the SAX parser will be silently ignored.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

Parameters:
handler - The content handler.
Throws:
java.lang.NullPointerException - If the handler argument is null.
See Also:
getContentHandler()

getContentHandler

Return the current content handler.
Returns:
The current content handler, or null if none

startDTD

public void startDTD(org.apache.xerces.utils.QName rootElement,
                     int publicId,
                     int systemId)
              throws java.lang.Exception
This function will be called when a <!DOCTYPE...> declaration is encountered.
Specified by:
startDTD in interface XMLDocumentHandler.DTDHandler
Tags copied from interface: XMLDocumentHandler.DTDHandler
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.
Specified by:
endDTD in interface XMLDocumentHandler.DTDHandler

elementDecl

public void elementDecl(org.apache.xerces.utils.QName elementDecl,
                        int contentSpecType,
                        int contentSpecIndex,
                        XMLContentSpec.Provider contentSpecProvider)
                 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.
Specified by:
elementDecl in interface XMLDocumentHandler.DTDHandler

attlistDecl

public void attlistDecl(org.apache.xerces.utils.QName elementDecl,
                        org.apache.xerces.utils.QName attributeDecl,
                        int attType,
                        boolean attList,
                        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.
Specified by:
attlistDecl in interface XMLDocumentHandler.DTDHandler
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,

internalPEDecl

public void internalPEDecl(int entityName,
                           int entityValue)
                    throws java.lang.Exception
Report an internal parameter entity declaration.
Specified by:
internalPEDecl in interface XMLDocumentHandler.DTDHandler
Tags copied from interface: XMLDocumentHandler.DTDHandler
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.
Specified by:
externalPEDecl in interface XMLDocumentHandler.DTDHandler
Tags copied from interface: XMLDocumentHandler.DTDHandler
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.
Specified by:
internalEntityDecl in interface XMLDocumentHandler.DTDHandler
Tags copied from interface: XMLDocumentHandler.DTDHandler
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.
Specified by:
externalEntityDecl in interface XMLDocumentHandler.DTDHandler
Tags copied from interface: XMLDocumentHandler.DTDHandler
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.
Specified by:
unparsedEntityDecl in interface XMLDocumentHandler.DTDHandler
Tags copied from interface: XMLDocumentHandler.DTDHandler
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.
Specified by:
notationDecl in interface XMLDocumentHandler.DTDHandler
Tags copied from interface: XMLDocumentHandler.DTDHandler
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()
                   throws java.lang.Exception
Start document.
Specified by:
startDocument in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
Throws:
java.lang.Exception -  

endDocument

public void endDocument()
                 throws java.lang.Exception
End document.
Specified by:
endDocument in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
Throws:
java.lang.Exception -  

                    int encodingIndex,
                    int standaloneIndex)
             throws java.lang.Exception
XML declaration.
Tags copied from interface: XMLDocumentHandler
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 -  

textDecl

public void textDecl(int versionIndex,
                     int encodingIndex)
              throws java.lang.Exception
Text declaration.
Specified by:
textDecl in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
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.
Specified by:
startNamespaceDeclScope in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
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.
Specified by:
endNamespaceDeclScope in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
Parameters:
prefix - string pool index of the namespace prefix being declared
Throws:
java.lang.Exception -  

internalSubset

public void internalSubset(int internalSubset)
New callback from DOM Level 2. There is no corresponding SAX callout for this yet.
Specified by:
internalSubset in interface XMLDocumentHandler.DTDHandler

startElement

public void startElement(org.apache.xerces.utils.QName element,
                         XMLAttrList attrList,
                         int attrListIndex)
                  throws java.lang.Exception
Start element
Specified by:
startElement in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
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(org.apache.xerces.utils.QName element)
                throws java.lang.Exception
End element.
Specified by:
endElement in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
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.
Specified by:
startEntityReference in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
Parameters:
entityName - string pool index of the entity name
entityType - the XMLEntityHandler.ENTITYTYPE_* type
entityContext - the XMLEntityHandler.ENTITYREF_* 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.
Specified by:
endEntityReference in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
Parameters:
entityName - string pool index of the entity anem
entityType - the XMLEntityHandler.ENTITYTYPE_* type
entityContext - the XMLEntityHandler.ENTITYREF_* 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.
Specified by:
startCDATA in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
Throws:
java.lang.Exception -  

endCDATA

public void endCDATA()
              throws java.lang.Exception
End CDATA section.
Specified by:
endCDATA in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
Throws:
java.lang.Exception -  

characters

public void characters(int dataIndex)
                throws java.lang.Exception
Not called.
Specified by:
characters in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
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.
Specified by:
ignorableWhitespace in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
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.
Specified by:
processingInstruction in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
Parameters:
target - string pool index of the PI target
data - string pool index of the PI data
Throws:
java.lang.Exception -  

comment

public void comment(int dataIndex)
             throws java.lang.Exception
Comment.
Specified by:
comment in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
Parameters:
comment - 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.
Specified by:
characters in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
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.
Specified by:
ignorableWhitespace in interface XMLDocumentHandler
Tags copied from interface: XMLDocumentHandler
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 3.1.1