Package gov.aps.jca.configuration
Class SAXConfigurationHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- gov.aps.jca.configuration.SAXConfigurationHandler
-
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
- Direct Known Subclasses:
NamespacedSAXConfigurationHandler
public class SAXConfigurationHandler extends DefaultHandler implements ErrorHandler
A SAXConfigurationHandler helps build Configurations out of sax events.- Author:
- Federico Barbieri, Peter Donald
-
-
Constructor Summary
Constructors Constructor Description SAXConfigurationHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] ch, int start, int end)Handling hook for character data.voidclear()Clears all data from this configuration handler.protected DefaultConfigurationcreateConfiguration(String localName, String location)Create a newDefaultConfigurationwith the specified local name and location.voidendElement(String namespaceURI, String localName, String rawName)Handling hook for finishing parsing of an element.voiderror(SAXParseException exception)This just throws an exception on a parse error.voidfatalError(SAXParseException exception)This just throws an exception on a parse error.ConfigurationgetConfiguration()Get the configuration object that was built.protected StringgetLocationString()Returns a string showing the current system ID, line number and column number.voidsetDocumentLocator(Locator locator)Set the documentLocatorto use.voidstartElement(String namespaceURI, String localName, String rawName, Attributes attributes)Handling hook for starting parsing of an element.voidwarning(SAXParseException exception)This just throws an exception on a parse error.-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
-
-
-
-
Method Detail
-
getConfiguration
public Configuration getConfiguration()
Get the configuration object that was built.- Returns:
- a
Configurationobject
-
clear
public void clear()
Clears all data from this configuration handler.
-
setDocumentLocator
public void setDocumentLocator(Locator locator)
Set the documentLocatorto use.- Specified by:
setDocumentLocatorin interfaceContentHandler- Overrides:
setDocumentLocatorin classDefaultHandler- Parameters:
locator- aLocatorvalue
-
characters
public void characters(char[] ch, int start, int end) throws SAXExceptionHandling hook for character data.- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Parameters:
ch- achar[]of datastart- offset in the character array from which to start readingend- length of character data- Throws:
SAXException- if an error occurs
-
endElement
public void endElement(String namespaceURI, String localName, String rawName) throws SAXException
Handling hook for finishing parsing of an element.- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Parameters:
namespaceURI- aStringvaluelocalName- aStringvaluerawName- aStringvalue- Throws:
SAXException- if an error occurs
-
createConfiguration
protected DefaultConfiguration createConfiguration(String localName, String location)
Create a newDefaultConfigurationwith the specified local name and location.- Parameters:
localName- aStringvaluelocation- aStringvalue- Returns:
- a
DefaultConfigurationvalue
-
startElement
public void startElement(String namespaceURI, String localName, String rawName, Attributes attributes) throws SAXException
Handling hook for starting parsing of an element.- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Parameters:
namespaceURI- aStringvaluelocalName- aStringvaluerawName- aStringvalueattributes- anAttributesvalue- Throws:
SAXException- if an error occurs
-
error
public void error(SAXParseException exception) throws SAXException
This just throws an exception on a parse error.- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Parameters:
exception- the parse error- Throws:
SAXException- if an error occurs
-
warning
public void warning(SAXParseException exception) throws SAXException
This just throws an exception on a parse error.- Specified by:
warningin interfaceErrorHandler- Overrides:
warningin classDefaultHandler- Parameters:
exception- the parse error- Throws:
SAXException- if an error occurs
-
fatalError
public void fatalError(SAXParseException exception) throws SAXException
This just throws an exception on a parse error.- Specified by:
fatalErrorin interfaceErrorHandler- Overrides:
fatalErrorin classDefaultHandler- Parameters:
exception- the parse error- Throws:
SAXException- if an error occurs
-
getLocationString
protected String getLocationString()
Returns a string showing the current system ID, line number and column number.- Returns:
- a
Stringvalue
-
-