org.apache.cocoon.transformation.helpers
Class InterpolatingConfigurationHandler

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.apache.avalon.framework.configuration.SAXConfigurationHandler
          extended byorg.apache.cocoon.transformation.helpers.InterpolatingConfigurationHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class InterpolatingConfigurationHandler
extends SAXConfigurationHandler

A SAX ContentHandler that builds Avalon Configuration objects, but also replaces variables of the form {var} with values from a map.

Version:
$Id: InterpolatingConfigurationHandler.html 1304280 2012-03-23 11:18:01Z ilgrosso $
See Also:
VariableConfiguration

Constructor Summary
InterpolatingConfigurationHandler(Map vars)
          Constructor.
InterpolatingConfigurationHandler(Map vars, String location)
          Constructor.
 
Method Summary
 void characters(char[] ch, int start, int len)
          Replace {vars} in element bodies.
protected  String getLocationString()
           
 void startElement(String uri, String localName, String qName, Attributes attr)
          Replace {vars} in attributes.
 
Methods inherited from class org.apache.avalon.framework.configuration.SAXConfigurationHandler
clear, createConfiguration, endElement, error, fatalError, getConfiguration, setDocumentLocator, warning
 
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

InterpolatingConfigurationHandler

public InterpolatingConfigurationHandler(Map vars)
Constructor.

Parameters:
vars - The mappings from variable name to value.

InterpolatingConfigurationHandler

public InterpolatingConfigurationHandler(Map vars,
                                         String location)
Constructor.

Parameters:
vars - The mappings from variable name to value.
location - The origin of this configuration info.
Method Detail

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attr)
                  throws SAXException
Replace {vars} in attributes.

Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int len)
                throws SAXException
Replace {vars} in element bodies.

Throws:
SAXException

getLocationString

protected String getLocationString()


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.