Class NamespacedSAXConfigurationHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.apache.avalon.framework.configuration.SAXConfigurationHandler
-
- org.apache.avalon.framework.configuration.NamespacedSAXConfigurationHandler
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
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
Fields Modifier and Type Field Description private static int
EXPECTED_DEPTH
Likely number of nested configuration items.private org.apache.avalon.framework.configuration.Configuration
m_configuration
private java.util.ArrayList
m_elements
private org.xml.sax.Locator
m_locator
private org.xml.sax.helpers.NamespaceSupport
m_namespaceSupport
private java.util.ArrayList
m_prefixes
private java.util.BitSet
m_preserveSpace
Contains true at index n if space in the configuration with depth n is to be preserved.private java.util.ArrayList
m_values
-
Constructor Summary
Constructors Constructor Description NamespacedSAXConfigurationHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] ch, int start, int end)
Handling hook for character data.void
clear()
Clears all data from this configuration handler.protected DefaultConfiguration
createConfiguration(java.lang.String localName, java.lang.String namespaceURI, java.lang.String location)
Create a newDefaultConfiguration
with the specified local name, namespace, and location.void
endDocument()
Handling hook for ending the document parsing.void
endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String rawName)
Handling hook for finishing parsing of an element.void
error(org.xml.sax.SAXParseException exception)
This just throws an exception on a parse error.void
fatalError(org.xml.sax.SAXParseException exception)
This just throws an exception on a parse error.org.apache.avalon.framework.configuration.Configuration
getConfiguration()
Get the configuration object that was built.protected java.lang.String
getLocationString()
Returns a string showing the current system ID, line number and column number.void
setDocumentLocator(org.xml.sax.Locator locator)
Set the documentLocator
to use.void
startDocument()
Handling hook for starting the document parsing.void
startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String rawName, org.xml.sax.Attributes attributes)
Handling hook for starting parsing of an element.void
startPrefixMapping(java.lang.String prefix, java.lang.String uri)
Handling hook for starting prefix mapping.void
warning(org.xml.sax.SAXParseException exception)
This just throws an exception on a parse error.-
Methods inherited from class org.apache.avalon.framework.configuration.SAXConfigurationHandler
createConfiguration
-
-
-
-
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.- See Also:
- Constant Field Values
-
m_elements
private final java.util.ArrayList m_elements
-
m_prefixes
private final java.util.ArrayList m_prefixes
-
m_values
private final java.util.ArrayList m_values
-
m_preserveSpace
private final java.util.BitSet 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
private org.xml.sax.Locator m_locator
-
m_namespaceSupport
private org.xml.sax.helpers.NamespaceSupport m_namespaceSupport
-
-
Method Detail
-
getConfiguration
public org.apache.avalon.framework.configuration.Configuration getConfiguration()
Get the configuration object that was built.- Overrides:
getConfiguration
in classSAXConfigurationHandler
- Returns:
- a
Configuration
object
-
clear
public void clear()
Clears all data from this configuration handler.- Overrides:
clear
in classSAXConfigurationHandler
-
setDocumentLocator
public void setDocumentLocator(org.xml.sax.Locator locator)
Set the documentLocator
to use.- Specified by:
setDocumentLocator
in interfaceorg.xml.sax.ContentHandler
- Overrides:
setDocumentLocator
in classSAXConfigurationHandler
- Parameters:
locator
- aLocator
value
-
startDocument
public void startDocument() throws org.xml.sax.SAXException
Handling hook for starting the document parsing.- Specified by:
startDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startDocument
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
- if an error occurs
-
endDocument
public void endDocument() throws org.xml.sax.SAXException
Handling hook for ending the document parsing.- Specified by:
endDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endDocument
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
- if an error occurs
-
characters
public void characters(char[] ch, int start, int end) throws org.xml.sax.SAXException
Handling hook for character data.- Specified by:
characters
in interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classSAXConfigurationHandler
- Parameters:
ch
- achar[]
of datastart
- offset in the character array from which to start readingend
- length of character data- Throws:
org.xml.sax.SAXException
- if an error occurs
-
endElement
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String rawName) throws org.xml.sax.SAXException
Handling hook for finishing parsing of an element.- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classSAXConfigurationHandler
- Parameters:
namespaceURI
- aString
valuelocalName
- aString
valuerawName
- aString
value- Throws:
org.xml.sax.SAXException
- if an error occurs
-
createConfiguration
protected DefaultConfiguration createConfiguration(java.lang.String localName, java.lang.String namespaceURI, java.lang.String location)
Create a newDefaultConfiguration
with the specified local name, namespace, and location.- Parameters:
localName
- aString
valuenamespaceURI
- aString
valuelocation
- aString
value- Returns:
- a
DefaultConfiguration
value
-
startElement
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String rawName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
Handling hook for starting parsing of an element.- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classSAXConfigurationHandler
- Parameters:
namespaceURI
- aString
valuelocalName
- aString
valuerawName
- aString
valueattributes
- anAttributes
value- Throws:
org.xml.sax.SAXException
- if an error occurs
-
error
public void error(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
This just throws an exception on a parse error.- Specified by:
error
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
error
in classSAXConfigurationHandler
- Parameters:
exception
- the parse error- Throws:
org.xml.sax.SAXException
- if an error occurs
-
warning
public void warning(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
This just throws an exception on a parse error.- Specified by:
warning
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
warning
in classSAXConfigurationHandler
- Parameters:
exception
- the parse error- Throws:
org.xml.sax.SAXException
- if an error occurs
-
fatalError
public void fatalError(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
This just throws an exception on a parse error.- Specified by:
fatalError
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
fatalError
in classSAXConfigurationHandler
- Parameters:
exception
- the parse error- Throws:
org.xml.sax.SAXException
- if an error occurs
-
getLocationString
protected java.lang.String getLocationString()
Returns a string showing the current system ID, line number and column number.- Overrides:
getLocationString
in classSAXConfigurationHandler
- Returns:
- a
String
value
-
startPrefixMapping
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
Handling hook for starting prefix mapping.- Specified by:
startPrefixMapping
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startPrefixMapping
in classorg.xml.sax.helpers.DefaultHandler
- Parameters:
prefix
- aString
valueuri
- aString
value- Throws:
org.xml.sax.SAXException
- if an error occurs
-
-