org.apache.avalon.framework.configuration

Class NamespacedSAXConfigurationHandler

public class NamespacedSAXConfigurationHandler extends SAXConfigurationHandler

A SAXConfigurationHandler helps build Configurations out of sax events, including namespace information.

Version: $Id: NamespacedSAXConfigurationHandler.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $

Author: Avalon Development Team

Field Summary
static intEXPECTED_DEPTH
Likely number of nested configuration items.
Configurationm_configuration
ArrayListm_elements
Locatorm_locator
NamespaceSupportm_namespaceSupport
ArrayListm_prefixes
BitSetm_preserveSpace
Contains true at index n if space in the configuration with depth n is to be preserved.
ArrayListm_values
Method Summary
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 namespaceURI, String location)
Create a new DefaultConfiguration with the specified local name, namespace, and location.
voidendDocument()
Handling hook for ending the document parsing.
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 document Locator to use.
voidstartDocument()
Handling hook for starting the document parsing.
voidstartElement(String namespaceURI, String localName, String rawName, Attributes attributes)
Handling hook for starting parsing of an element.
voidstartPrefixMapping(String prefix, String uri)
Handling hook for starting prefix mapping.
voidwarning(SAXParseException exception)
This just throws an exception on a parse error.

Field Detail

EXPECTED_DEPTH

private static final int EXPECTED_DEPTH
Likely number of nested configuration items. If more is encountered the lists will grow automatically.

m_configuration

private Configuration m_configuration

m_elements

private final ArrayList m_elements

m_locator

private Locator m_locator

m_namespaceSupport

private NamespaceSupport m_namespaceSupport

m_prefixes

private final ArrayList m_prefixes

m_preserveSpace

private final BitSet m_preserveSpace
Contains true at index n if space in the configuration with depth n is to be preserved.

m_values

private final ArrayList m_values

Method Detail

characters

public void characters(char[] ch, int start, int end)
Handling hook for character data.

Parameters: ch a char[] of data start offset in the character array from which to start reading end length of character data

Throws: SAXException if an error occurs

clear

public void clear()
Clears all data from this configuration handler.

createConfiguration

protected DefaultConfiguration createConfiguration(String localName, String namespaceURI, String location)
Create a new DefaultConfiguration with the specified local name, namespace, and location.

Parameters: localName a String value namespaceURI a String value location a String value

Returns: a DefaultConfiguration value

endDocument

public void endDocument()
Handling hook for ending the document parsing.

Throws: SAXException if an error occurs

endElement

public void endElement(String namespaceURI, String localName, String rawName)
Handling hook for finishing parsing of an element.

Parameters: namespaceURI a String value localName a String value rawName a String value

Throws: SAXException if an error occurs

error

public void error(SAXParseException exception)
This just throws an exception on a parse error.

Parameters: exception the parse error

Throws: SAXException if an error occurs

fatalError

public void fatalError(SAXParseException exception)
This just throws an exception on a parse error.

Parameters: exception the parse error

Throws: SAXException if an error occurs

getConfiguration

public Configuration getConfiguration()
Get the configuration object that was built.

Returns: a Configuration object

getLocationString

protected String getLocationString()
Returns a string showing the current system ID, line number and column number.

Returns: a String value

setDocumentLocator

public void setDocumentLocator(Locator locator)
Set the document Locator to use.

Parameters: locator a Locator value

startDocument

public void startDocument()
Handling hook for starting the document parsing.

Throws: SAXException if an error occurs

startElement

public void startElement(String namespaceURI, String localName, String rawName, Attributes attributes)
Handling hook for starting parsing of an element.

Parameters: namespaceURI a String value localName a String value rawName a String value attributes an Attributes value

Throws: SAXException if an error occurs

startPrefixMapping

public void startPrefixMapping(String prefix, String uri)
Handling hook for starting prefix mapping.

Parameters: prefix a String value uri a String value

Throws: SAXException if an error occurs

warning

public void warning(SAXParseException exception)
This just throws an exception on a parse error.

Parameters: exception the parse error

Throws: SAXException if an error occurs