Xerces 2.0.0.alpha

org.apache.xerces.parsers
Class SAXParser

java.lang.Object
  |
  +--org.apache.xerces.parsers.XMLParser
        |
        +--org.apache.xerces.parsers.XMLDocumentParser
              |
              +--org.apache.xerces.parsers.SAXParser
All Implemented Interfaces:
Parser, org.apache.xerces.xni.XMLComponentManager, org.apache.xerces.xni.XMLDocumentHandler, org.apache.xerces.xni.XMLDTDContentModelHandler, org.apache.xerces.xni.XMLDTDHandler, XMLReader

public class SAXParser
extends XMLDocumentParser
implements org.apache.xerces.xni.XMLDTDHandler, Parser, XMLReader

Version:
$Id: SAXParser.java,v 1.12.2.13 2000/11/02 02:11:24 ericye Exp $

Fields inherited from class org.apache.xerces.parsers.XMLDocumentParser
fDatatypeValidatorFactory, fDTDScanner, fGrammarPool, fParseInProgress, fScanner, fValidator
 
Fields inherited from class org.apache.xerces.parsers.XMLParser
fEntityManager, fErrorReporter, fFeatures, fLocator, fProperties, fSymbolTable
 
Fields inherited from interface org.apache.xerces.xni.XMLDTDHandler
CONDITIONAL_IGNORE, CONDITIONAL_INCLUDE
 
Fields inherited from interface org.apache.xerces.xni.XMLDTDContentModelHandler
OCCURS_ONE_OR_MORE, OCCURS_ZERO_OR_MORE, OCCURS_ZERO_OR_ONE, SEPARATOR_CHOICE, SEPARATOR_SEQUENCE, TYPE_ANY, TYPE_CHILDREN, TYPE_EMPTY, TYPE_MIXED
 
Constructor Summary
SAXParser()
          Default constructor.
SAXParser(org.apache.xerces.util.SymbolTable symbolTable, org.apache.xerces.impl.validation.GrammarPool grammarPool)
          Constructor allowing to specify the SymbolTable and GrammarPool to use.
 
Method Summary
 void attributeDecl(java.lang.String elementName, java.lang.String attributeName, java.lang.String type, java.lang.String[] enumeration, java.lang.String defaultType, org.apache.xerces.xni.XMLString defaultValue)
          attributeDecl
 void characters(org.apache.xerces.xni.XMLString text)
          Character content.
 void comment(org.apache.xerces.xni.XMLString text)
          comment
 void doctypeDecl(java.lang.String rootElement, java.lang.String publicId, java.lang.String systemId)
          Notifies of the presence of the DOCTYPE line in the document.
 void elementDecl(java.lang.String name, java.lang.String contentModel)
          elementDecl
 void endAttlist()
          endAttlist
 void endConditional()
          endConditional
 void endDocument()
          The end of the document.
 void endDTD()
          endDTD
 void endElement(org.apache.xerces.xni.QName element)
          The end of an element.
 void endExternalSubset()
          endExternalSubset
 void externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Report a parsed external entity declaration.
 ContentHandler getContentHandler()
          Return the current content handler.
protected  DeclHandler getDeclHandler()
          Returns the DTD declaration event handler.
 DTDHandler getDTDHandler()
          Return the current DTD handler.
 boolean getFeature(java.lang.String featureId)
          Query the state of a feature.
protected  LexicalHandler getLexicalHandler()
          Returns the lexical handler.
 java.lang.Object getProperty(java.lang.String propertyId)
          Query the value of a property.
 void ignorableWhitespace(org.apache.xerces.xni.XMLString text)
          Ignorable whitespace.
 void internalEntityDecl(java.lang.String name, org.apache.xerces.xni.XMLString text)
          internalEntityDecl
 void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          notationDecl
 void processingInstruction(java.lang.String target, org.apache.xerces.xni.XMLString data)
          processingInstruction
 void setContentHandler(ContentHandler handler)
          Allow an application to register a content event handler.
protected  void setDeclHandler(DeclHandler handler)
          Set the DTD declaration event handler.
 void setDocumentHandler(DocumentHandler documentHandler)
          Sets the document handler.
 void setDTDHandler(DTDHandler handler)
          Allow an application to register a DTD event handler.
 void setFeature(java.lang.String featureId, boolean state)
          Set the state of any feature in a SAX2 parser.
protected  void setLexicalHandler(LexicalHandler handler)
          Set the lexical event handler.
 void setProperty(java.lang.String propertyId, java.lang.Object value)
          Set the value of any property in a SAX2 parser.
 void startAttlist(java.lang.String elementName)
          startAttlist
 void startConditional(short type)
          startConditional
 void startDocument()
          The start of the document.
 void startDTD()
          startDTD
 void startElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes)
          The start of an element.
 void startExternalSubset()
          startExternalSubset
 void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notation)
          unparsedEntityDecl
 
Methods inherited from class org.apache.xerces.parsers.XMLDocumentParser
checkFeature, checkProperty, childrenElement, childrenEndGroup, childrenOccurrence, childrenSeparator, childrenStartGroup, endCDATA, endContentModel, endEntity, endPrefixMapping, mixedElement, parse, reset, startCDATA, startContentModel, startEntity, startPrefixMapping, textDecl, xmlDecl
 
Methods inherited from class org.apache.xerces.parsers.XMLParser
getEntityResolver, getErrorHandler, parse, setEntityResolver, setErrorHandler, setLocale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.xerces.xni.XMLDTDHandler
endEntity, startEntity, textDecl
 
Methods inherited from interface org.xml.sax.Parser
parse, parse, setEntityResolver, setErrorHandler, setLocale
 
Methods inherited from interface org.xml.sax.XMLReader
getEntityResolver, getErrorHandler, parse, parse, setEntityResolver, setErrorHandler
 

Constructor Detail

SAXParser

public SAXParser()
Default constructor.

SAXParser

public SAXParser(org.apache.xerces.util.SymbolTable symbolTable,
                 org.apache.xerces.impl.validation.GrammarPool grammarPool)
Constructor allowing to specify the SymbolTable and GrammarPool to use.
Parameters:
symbolTable -  
grammarPool -  
Method Detail

startDocument

public void startDocument()
                   throws SAXException
Description copied from class: XMLDocumentParser
The start of the document.
Overrides:
startDocument in class XMLDocumentParser
Following copied from class: org.apache.xerces.parsers.XMLDocumentParser
Throws:
SAXException - Thrown by handler to signal an error.

startElement

public void startElement(org.apache.xerces.xni.QName element,
                         org.apache.xerces.xni.XMLAttributes attributes)
                  throws SAXException
Description copied from class: XMLDocumentParser
The start of an element. If the document specifies the start element by using an empty tag, then the startElement method will immediately be followed by the endElement method, with no intervening methods.
Overrides:
startElement in class XMLDocumentParser
Following copied from class: org.apache.xerces.parsers.XMLDocumentParser
Parameters:
element - The name of the element.
attributes - The element attributes.
Throws:
SAXException - Thrown by handler to signal an error.

characters

public void characters(org.apache.xerces.xni.XMLString text)
                throws SAXException
Description copied from class: XMLDocumentParser
Character content.
Overrides:
characters in class XMLDocumentParser
Following copied from class: org.apache.xerces.parsers.XMLDocumentParser
Parameters:
text - The content.
Throws:
SAXException - Thrown by handler to signal an error.

ignorableWhitespace

public void ignorableWhitespace(org.apache.xerces.xni.XMLString text)
                         throws SAXException
Description copied from class: XMLDocumentParser
Ignorable whitespace. For this method to be called, the document source must have some way of determining that the text containing only whitespace characters should be considered ignorable. For example, the validator can determine if a length of whitespace characters in the document are ignorable based on the element content model.
Overrides:
ignorableWhitespace in class XMLDocumentParser
Following copied from class: org.apache.xerces.parsers.XMLDocumentParser
Parameters:
text - The ignorable whitespace.
Throws:
SAXException - Thrown by handler to signal an error.

endElement

public void endElement(org.apache.xerces.xni.QName element)
                throws SAXException
Description copied from class: XMLDocumentParser
The end of an element.
Overrides:
endElement in class XMLDocumentParser
Following copied from class: org.apache.xerces.parsers.XMLDocumentParser
Parameters:
element - The name of the element.
Throws:
SAXException - Thrown by handler to signal an error.

endDocument

public void endDocument()
                 throws SAXException
Description copied from class: XMLDocumentParser
The end of the document.
Overrides:
endDocument in class XMLDocumentParser
Following copied from class: org.apache.xerces.parsers.XMLDocumentParser
Throws:
SAXException - Thrown by handler to signal an error.

startDTD

public void startDTD()
              throws SAXException
startDTD
Specified by:
startDTD in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
startDTD in class XMLDocumentParser
Following copied from class: org.apache.xerces.parsers.XMLDocumentParser
Throws:
SAXException - Thrown by handler to signal an error.

doctypeDecl

public void doctypeDecl(java.lang.String rootElement,
                        java.lang.String publicId,
                        java.lang.String systemId)
                 throws SAXException
Description copied from class: XMLDocumentParser
Notifies of the presence of the DOCTYPE line in the document.
Overrides:
doctypeDecl in class XMLDocumentParser
Parameters:
rootElement -  
publicId -  
systemId -  

comment

public void comment(org.apache.xerces.xni.XMLString text)
             throws SAXException
comment
Specified by:
comment in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
comment in class XMLDocumentParser
Parameters:
text -  

processingInstruction

public void processingInstruction(java.lang.String target,
                                  org.apache.xerces.xni.XMLString data)
                           throws SAXException
processingInstruction
Specified by:
processingInstruction in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
processingInstruction in class XMLDocumentParser
Parameters:
target -  
data -  

startExternalSubset

public void startExternalSubset()
                         throws SAXException
startExternalSubset

endExternalSubset

public void endExternalSubset()
                       throws SAXException
endExternalSubset

elementDecl

public void elementDecl(java.lang.String name,
                        java.lang.String contentModel)
                 throws SAXException
elementDecl
Specified by:
elementDecl in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
elementDecl in class XMLDocumentParser
Parameters:
name -  
contentModel -  

startAttlist

public void startAttlist(java.lang.String elementName)
                  throws SAXException
startAttlist
Specified by:
startAttlist in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
startAttlist in class XMLDocumentParser
Parameters:
elementName -  

attributeDecl

public void attributeDecl(java.lang.String elementName,
                          java.lang.String attributeName,
                          java.lang.String type,
                          java.lang.String[] enumeration,
                          java.lang.String defaultType,
                          org.apache.xerces.xni.XMLString defaultValue)
                   throws SAXException
attributeDecl
Specified by:
attributeDecl in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
attributeDecl in class XMLDocumentParser
Parameters:
elementName -  
attributeName -  
type -  
enumeration -  
defaultType -  
defaultValue -  

endAttlist

public void endAttlist()
                throws SAXException
endAttlist
Specified by:
endAttlist in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
endAttlist in class XMLDocumentParser
Following copied from class: org.apache.xerces.parsers.XMLDocumentParser
Throws:
SAXException - Thrown by handler to signal an error.

internalEntityDecl

public void internalEntityDecl(java.lang.String name,
                               org.apache.xerces.xni.XMLString text)
                        throws SAXException
internalEntityDecl
Specified by:
internalEntityDecl in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
internalEntityDecl in class XMLDocumentParser
Parameters:
name -  
text -  

externalEntityDecl

public void externalEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId)
                        throws SAXException
Report a parsed external entity declaration.
Specified by:
externalEntityDecl in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
externalEntityDecl in class XMLDocumentParser
Parameters:
name -  
publicId -  
systemId -  

unparsedEntityDecl

public void unparsedEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId,
                               java.lang.String notation)
                        throws SAXException
unparsedEntityDecl
Specified by:
unparsedEntityDecl in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
unparsedEntityDecl in class XMLDocumentParser
Parameters:
name -  
publicId -  
systemId -  
notation -  

notationDecl

public void notationDecl(java.lang.String name,
                         java.lang.String publicId,
                         java.lang.String systemId)
                  throws SAXException
notationDecl
Specified by:
notationDecl in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
notationDecl in class XMLDocumentParser
Parameters:
name -  
publicId -  
systemId -  

startConditional

public void startConditional(short type)
                      throws SAXException
startConditional
Specified by:
startConditional in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
startConditional in class XMLDocumentParser
Parameters:
type -  

endConditional

public void endConditional()
                    throws SAXException
endConditional
Specified by:
endConditional in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
endConditional in class XMLDocumentParser
Following copied from class: org.apache.xerces.parsers.XMLDocumentParser
Throws:
SAXException - Thrown by handler to signal an error.

endDTD

public void endDTD()
            throws SAXException
endDTD
Specified by:
endDTD in interface org.apache.xerces.xni.XMLDTDHandler
Overrides:
endDTD in class XMLDocumentParser
Following copied from class: org.apache.xerces.parsers.XMLDocumentParser
Throws:
SAXException - Thrown by handler to signal an error.

setDTDHandler

public void setDTDHandler(DTDHandler handler)
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.

Specified by:
setDTDHandler in interface Parser
Parameters:
handler - The DTD handler.
Throws:
java.lang.NullPointerException - If the handler argument is null.
See Also:
getDTDHandler()

setDocumentHandler

public void setDocumentHandler(DocumentHandler documentHandler)
Sets the document handler.
Specified by:
setDocumentHandler in interface Parser
Parameters:
documentHandler -  

setContentHandler

public void setContentHandler(ContentHandler handler)
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.

Specified by:
setContentHandler in interface XMLReader
Parameters:
handler - The content handler.
Throws:
java.lang.NullPointerException - If the handler argument is null.
See Also:
getContentHandler()

getContentHandler

public ContentHandler getContentHandler()
Return the current content handler.
Specified by:
getContentHandler in interface XMLReader
Returns:
The current content handler, or null if none has been registered.
See Also:
setContentHandler(org.xml.sax.ContentHandler)

getDTDHandler

public DTDHandler getDTDHandler()
Return the current DTD handler.
Specified by:
getDTDHandler in interface XMLReader
Returns:
The current DTD handler, or null if none has been registered.
See Also:
setDTDHandler(org.xml.sax.DTDHandler)

setDeclHandler

protected void setDeclHandler(DeclHandler handler)
                       throws SAXNotRecognizedException,
                              SAXNotSupportedException
Set the DTD declaration event handler.

This method is the equivalent to the property:

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

getDeclHandler

protected DeclHandler getDeclHandler()
                              throws SAXNotRecognizedException,
                                     SAXNotSupportedException
Returns the DTD declaration event handler.
See Also:
setDeclHandler(org.xml.sax.ext.DeclHandler)

setLexicalHandler

protected void setLexicalHandler(LexicalHandler handler)
                          throws SAXNotRecognizedException,
                                 SAXNotSupportedException
Set the lexical event handler.

This method is the equivalent to the property:

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

getLexicalHandler

protected LexicalHandler getLexicalHandler()
                                    throws SAXNotRecognizedException,
                                           SAXNotSupportedException
Returns the lexical handler.
See Also:
setLexicalHandler(org.xml.sax.ext.LexicalHandler)

setFeature

public void setFeature(java.lang.String featureId,
                       boolean state)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException
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.
Specified by:
setFeature in interface XMLReader
Overrides:
setFeature in class XMLDocumentParser
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.

getFeature

public boolean getFeature(java.lang.String featureId)
                   throws SAXNotRecognizedException,
                          SAXNotSupportedException
Query the state of a feature. Query the current state of any feature in a SAX2 parser. The parser might not recognize the feature.
Specified by:
getFeature in interface XMLReader
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.
SAXNotSupportedException - If the requested feature is known but not supported.

setProperty

public void setProperty(java.lang.String propertyId,
                        java.lang.Object value)
                 throws SAXNotRecognizedException,
                        SAXNotSupportedException
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.
Specified by:
setProperty in interface XMLReader
Overrides:
setProperty in class XMLDocumentParser
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.

getProperty

public java.lang.Object getProperty(java.lang.String propertyId)
                             throws SAXNotRecognizedException,
                                    SAXNotSupportedException
Query the value of a property. Return the current value of a property in a SAX2 parser. The parser might not recognize the property.
Specified by:
getProperty in interface XMLReader
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.
SAXNotSupportedException - If the requested property is known but not supported.

Xerces 2.0.0.alpha