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

public class SAXConfigurationHandler extends DefaultHandler implements ErrorHandler
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 Details

    • 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:
    • m_elements

      private final ArrayList m_elements
    • m_values

      private final ArrayList m_values
    • 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_configuration

      private org.apache.avalon.framework.configuration.Configuration m_configuration
    • m_locator

      private Locator 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

      public void setDocumentLocator(Locator locator)
      Set the document Locator to use.
      Specified by:
      setDocumentLocator in interface ContentHandler
      Overrides:
      setDocumentLocator in class DefaultHandler
      Parameters:
      locator - a Locator value
    • characters

      public void characters(char[] ch, int start, int end) throws SAXException
      Handling hook for character data.
      Specified by:
      characters in interface ContentHandler
      Overrides:
      characters in class DefaultHandler
      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
    • endElement

      public void endElement(String namespaceURI, String localName, String rawName) throws SAXException
      Handling hook for finishing parsing of an element.
      Specified by:
      endElement in interface ContentHandler
      Overrides:
      endElement in class DefaultHandler
      Parameters:
      namespaceURI - a String value
      localName - a String value
      rawName - a String value
      Throws:
      SAXException - if an error occurs
    • createConfiguration

      protected DefaultConfiguration createConfiguration(String localName, String location)
      Create a new DefaultConfiguration with the specified local name and location.
      Parameters:
      localName - a String value
      location - a String 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 interface ContentHandler
      Overrides:
      startElement in class DefaultHandler
      Parameters:
      namespaceURI - a String value
      localName - a String value
      rawName - a String value
      attributes - an Attributes value
      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:
      error in interface ErrorHandler
      Overrides:
      error in class DefaultHandler
      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:
      warning in interface ErrorHandler
      Overrides:
      warning in class DefaultHandler
      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:
      fatalError in interface ErrorHandler
      Overrides:
      fatalError in class DefaultHandler
      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 String value