Class SAXConfigurationHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.apache.avalon.framework.configuration.SAXConfigurationHandler
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
- Direct Known Subclasses:
NamespacedSAXConfigurationHandler
A SAXConfigurationHandler helps build Configurations out of sax events.
- Version:
- $Id: SAXConfigurationHandler.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $
- Author:
- Avalon Development Team
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
Likely number of nested configuration items.private org.apache.avalon.framework.configuration.Configuration
private final ArrayList
private Locator
private final BitSet
Contains true at index n if space in the configuration with depth n is to be preserved.private final ArrayList
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] ch, int start, int end) Handling hook for character data.void
clear()
Clears all data from this configuration handler.protected DefaultConfiguration
createConfiguration
(String localName, String location) Create a newDefaultConfiguration
with the specified local name and location.void
endElement
(String namespaceURI, String localName, String rawName) Handling hook for finishing parsing of an element.void
error
(SAXParseException exception) This just throws an exception on a parse error.void
fatalError
(SAXParseException exception) This just throws an exception on a parse error.org.apache.avalon.framework.configuration.Configuration
Get the configuration object that was built.protected String
Returns a string showing the current system ID, line number and column number.void
setDocumentLocator
(Locator locator) Set the documentLocator
to use.void
startElement
(String namespaceURI, String localName, String rawName, Attributes attributes) Handling hook for starting parsing of an element.void
warning
(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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
EXPECTED_DEPTH
private static final int EXPECTED_DEPTHLikely number of nested configuration items. If more is encountered the lists will grow automatically.- See Also:
-
m_elements
-
m_values
-
m_preserveSpace
Contains true at index n if space in the configuration with depth n is to be preserved. -
m_configuration
private org.apache.avalon.framework.configuration.Configuration m_configuration -
m_locator
-
-
Constructor Details
-
SAXConfigurationHandler
public SAXConfigurationHandler()
-
-
Method Details
-
getConfiguration
public org.apache.avalon.framework.configuration.Configuration getConfiguration()Get the configuration object that was built.- Returns:
- a
Configuration
object
-
clear
public void clear()Clears all data from this configuration handler. -
setDocumentLocator
Set the documentLocator
to use.- Specified by:
setDocumentLocator
in interfaceContentHandler
- Overrides:
setDocumentLocator
in classDefaultHandler
- Parameters:
locator
- aLocator
value
-
characters
Handling hook for character data.- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in 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
Handling hook for finishing parsing of an element.- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Parameters:
namespaceURI
- aString
valuelocalName
- aString
valuerawName
- aString
value- Throws:
SAXException
- if an error occurs
-
createConfiguration
Create a newDefaultConfiguration
with the specified local name and location.- Parameters:
localName
- aString
valuelocation
- aString
value- Returns:
- a
DefaultConfiguration
value
-
startElement
public void startElement(String namespaceURI, String localName, String rawName, Attributes attributes) throws SAXException Handling hook for starting parsing of an element.- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Parameters:
namespaceURI
- aString
valuelocalName
- aString
valuerawName
- aString
valueattributes
- anAttributes
value- Throws:
SAXException
- if an error occurs
-
error
This just throws an exception on a parse error.- Specified by:
error
in interfaceErrorHandler
- Overrides:
error
in classDefaultHandler
- Parameters:
exception
- the parse error- Throws:
SAXException
- if an error occurs
-
warning
This just throws an exception on a parse error.- Specified by:
warning
in interfaceErrorHandler
- Overrides:
warning
in classDefaultHandler
- Parameters:
exception
- the parse error- Throws:
SAXException
- if an error occurs
-
fatalError
This just throws an exception on a parse error.- Specified by:
fatalError
in interfaceErrorHandler
- Overrides:
fatalError
in classDefaultHandler
- Parameters:
exception
- the parse error- Throws:
SAXException
- if an error occurs
-
getLocationString
Returns a string showing the current system ID, line number and column number.- Returns:
- a
String
value
-