org.apache.avalon.framework.configuration
Class NamespacedSAXConfigurationHandler

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.apache.avalon.framework.configuration.SAXConfigurationHandler
          extended byorg.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 08:57:54Z niclas $
Author:
Avalon Development Team

Constructor Summary
NamespacedSAXConfigurationHandler()
           
 
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 namespaceURI, java.lang.String location)
          Create a new DefaultConfiguration 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.
 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 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
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamespacedSAXConfigurationHandler

public NamespacedSAXConfigurationHandler()
Method Detail

getConfiguration

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

Overrides:
getConfiguration in class SAXConfigurationHandler
Returns:
a Configuration object

clear

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

Overrides:
clear in class SAXConfigurationHandler

setDocumentLocator

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

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

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Handling hook for starting the document parsing.

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.

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 interface org.xml.sax.ContentHandler
Overrides:
characters in class SAXConfigurationHandler
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
Overrides:
endElement in class SAXConfigurationHandler
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 namespaceURI,
                                                   java.lang.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

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
Overrides:
startElement in class SAXConfigurationHandler
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
Overrides:
error in class SAXConfigurationHandler
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
Overrides:
warning in class SAXConfigurationHandler
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
Overrides:
fatalError in class SAXConfigurationHandler
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 class SAXConfigurationHandler
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.

Parameters:
prefix - a String value
uri - a String value
Throws:
org.xml.sax.SAXException - if an error occurs


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