org.pentaho.reporting.libraries.xmlns.parser
Class PropertiesReadHandler

java.lang.Object
  extended by org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler
      extended by org.pentaho.reporting.libraries.xmlns.parser.PropertiesReadHandler
All Implemented Interfaces:
XmlReadHandler

public class PropertiesReadHandler
extends AbstractXmlReadHandler

A read handler that creates property-structures (name-value-pairs) and returns the properties as java.util.Properties collection.

Author:
Thomas Morgner

Constructor Summary
PropertiesReadHandler()
          Creates a properties read-handler using "property" as child-tagname.
PropertiesReadHandler(java.lang.String propertyTagName)
          Creates a properties read-handler using the specified propertyTagName as child-tagname.
 
Method Summary
protected  void doneParsing()
          Done parsing.
protected  XmlReadHandler getHandlerForChild(java.lang.String uri, java.lang.String tagName, org.xml.sax.Attributes atts)
          Returns the handler for a child element.
 java.lang.Object getObject()
          Returns the resulting properties collection, never null.
 java.util.Properties getResult()
          Returns the resulting properties collection, never null.
 
Methods inherited from class org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler
characters, deriveParseParameters, endElement, getLocator, getRootHandler, getTagName, getUri, init, isSameNamespace, performExternalParsing, performExternalParsing, startElement, startParsing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesReadHandler

public PropertiesReadHandler()
Creates a properties read-handler using "property" as child-tagname.


PropertiesReadHandler

public PropertiesReadHandler(java.lang.String propertyTagName)
Creates a properties read-handler using the specified propertyTagName as child-tagname.

Parameters:
propertyTagName - the tag name for the child elements that define the properties.
Method Detail

getHandlerForChild

protected XmlReadHandler getHandlerForChild(java.lang.String uri,
                                            java.lang.String tagName,
                                            org.xml.sax.Attributes atts)
                                     throws org.xml.sax.SAXException
Returns the handler for a child element.

Overrides:
getHandlerForChild in class AbstractXmlReadHandler
Parameters:
tagName - the tag name.
atts - the attributes.
uri - the URI of the namespace of the current element.
Returns:
the handler or null, if the tagname is invalid.
Throws:
org.xml.sax.SAXException - if there is a parsing error.

doneParsing

protected void doneParsing()
                    throws org.xml.sax.SAXException
Done parsing.

Overrides:
doneParsing in class AbstractXmlReadHandler
Throws:
org.xml.sax.SAXException - if there is a parsing error.

getResult

public java.util.Properties getResult()
Returns the resulting properties collection, never null.

Returns:
the properties.

getObject

public java.lang.Object getObject()
                           throws org.xml.sax.SAXException
Returns the resulting properties collection, never null.

Returns:
the properties.
Throws:
org.xml.sax.SAXException - if there is a parsing error.