org.apache.avalon.framework.configuration
Class SAXConfigurationHandler

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.apache.avalon.framework.configuration.SAXConfigurationHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
Direct Known Subclasses:
NamespacedSAXConfigurationHandler

public class SAXConfigurationHandler
extends org.xml.sax.helpers.DefaultHandler
implements org.xml.sax.ErrorHandler

A SAXConfigurationHandler helps build Configurations out of sax events.

Version:
$Id: SAXConfigurationHandler.java 30977 2004-07-30 08:57:54Z niclas $
Author:
Avalon Development Team

Constructor Summary
SAXConfigurationHandler()
           
 
Method Summary
 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 location)
          Create a new DefaultConfiguration with the specified local name and location.
 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.
 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 document Locator to use.
 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 warning(org.xml.sax.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
 

Constructor Detail

SAXConfigurationHandler

public SAXConfigurationHandler()
Method Detail

getConfiguration

public 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(org.xml.sax.Locator locator)
Set the document Locator to use.

Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Parameters:
locator - a Locator value

characters

public void characters(char[] ch,
                       int start,
                       int end)
                throws org.xml.sax.SAXException
Handling hook for character data.

Specified by:
characters in interface org.xml.sax.ContentHandler
Parameters:
ch - a char[] of data
start - offset in the character array from which to start reading
end - 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 interface org.xml.sax.ContentHandler
Parameters:
namespaceURI - a String value
localName - a String value
rawName - a String value
Throws:
org.xml.sax.SAXException - if an error occurs

createConfiguration

protected DefaultConfiguration createConfiguration(java.lang.String localName,
                                                   java.lang.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(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 interface org.xml.sax.ContentHandler
Parameters:
namespaceURI - a String value
localName - a String value
rawName - a String value
attributes - an Attributes 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 interface org.xml.sax.ErrorHandler
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 interface org.xml.sax.ErrorHandler
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 interface org.xml.sax.ErrorHandler
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.

Returns:
a String value


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.