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:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
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
FieldsModifier and TypeFieldDescriptionprivate static final intLikely number of nested configuration items.private org.apache.avalon.framework.configuration.Configurationprivate final ArrayListprivate Locatorprivate NamespaceSupportprivate final ArrayListprivate final BitSetContains 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 TypeMethodDescriptionvoidcharacters(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 newDefaultConfigurationwith the specified local name, namespace, and location.voidHandling 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.org.apache.avalon.framework.configuration.ConfigurationGet the configuration object that was built.protected StringReturns a string showing the current system ID, line number and column number.voidsetDocumentLocator(Locator locator) Set the documentLocatorto use.voidHandling 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.Methods inherited from class SAXConfigurationHandler
createConfigurationMethods inherited from class DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, unparsedEntityDeclMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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_prefixes
-
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
-
m_namespaceSupport
-
-
Constructor Details
-
NamespacedSAXConfigurationHandler
public NamespacedSAXConfigurationHandler()
-
-
Method Details
-
getConfiguration
public org.apache.avalon.framework.configuration.Configuration getConfiguration()Get the configuration object that was built.- Overrides:
getConfigurationin classSAXConfigurationHandler- Returns:
- a
Configurationobject
-
clear
public void clear()Clears all data from this configuration handler.- Overrides:
clearin classSAXConfigurationHandler
-
setDocumentLocator
Set the documentLocatorto use.- Specified by:
setDocumentLocatorin interfaceContentHandler- Overrides:
setDocumentLocatorin classSAXConfigurationHandler- Parameters:
locator- aLocatorvalue
-
startDocument
Handling hook for starting the document parsing.- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler- Throws:
SAXException- if an error occurs
-
endDocument
Handling hook for ending the document parsing.- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler- Throws:
SAXException- if an error occurs
-
characters
Handling hook for character data.- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classSAXConfigurationHandler- 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:
endElementin interfaceContentHandler- Overrides:
endElementin classSAXConfigurationHandler- Parameters:
namespaceURI- aStringvaluelocalName- aStringvaluerawName- aStringvalue- Throws:
SAXException- if an error occurs
-
createConfiguration
protected DefaultConfiguration createConfiguration(String localName, String namespaceURI, String location) Create a newDefaultConfigurationwith the specified local name, namespace, and location.- Parameters:
localName- aStringvaluenamespaceURI- 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 classSAXConfigurationHandler- Parameters:
namespaceURI- aStringvaluelocalName- aStringvaluerawName- aStringvalueattributes- anAttributesvalue- Throws:
SAXException- if an error occurs
-
error
This just throws an exception on a parse error.- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classSAXConfigurationHandler- Parameters:
exception- the parse error- Throws:
SAXException- if an error occurs
-
warning
This just throws an exception on a parse error.- Specified by:
warningin interfaceErrorHandler- Overrides:
warningin classSAXConfigurationHandler- Parameters:
exception- the parse error- Throws:
SAXException- if an error occurs
-
fatalError
This just throws an exception on a parse error.- Specified by:
fatalErrorin interfaceErrorHandler- Overrides:
fatalErrorin classSAXConfigurationHandler- 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.- Overrides:
getLocationStringin classSAXConfigurationHandler- Returns:
- a
Stringvalue
-
startPrefixMapping
Handling hook for starting prefix mapping.- Specified by:
startPrefixMappingin interfaceContentHandler- Overrides:
startPrefixMappingin classDefaultHandler- Parameters:
prefix- aStringvalueuri- aStringvalue- Throws:
SAXException- if an error occurs
-