org.apache.commons.jelly.tags.xml
Class TransformTag.TagBodyXMLReader

java.lang.Object
  extended byorg.apache.commons.jelly.tags.xml.TransformTag.TagBodyXMLReader
All Implemented Interfaces:
org.xml.sax.XMLReader
Enclosing class:
TransformTag

private class TransformTag.TagBodyXMLReader
extends java.lang.Object
implements org.xml.sax.XMLReader

A helper class that converts a transform tag body to an XMLReader to hide the details of where the input for the transform is obtained

Version:
$Revision: 155420 $
Author:
Robert Leftwich

Field Summary
private  org.xml.sax.DTDHandler dtdHandler
          Storage for a DTDHandler if set by the user of the reader.
private  org.xml.sax.EntityResolver entityResolver
          Storage for a EntityResolver if set by the user of the reader.
private  org.xml.sax.ErrorHandler errorHandler
          Storage for a ErrorHandler if set by the user of the reader.
private  org.apache.commons.jelly.Tag tag
          The tag whose body is to be read.
private  org.apache.commons.jelly.XMLOutput xmlOutput
          The destination for the sax events generated by the reader.
 
Constructor Summary
TransformTag.TagBodyXMLReader(org.apache.commons.jelly.Tag tag)
          Construct an XMLReader for the specified Tag
 
Method Summary
private  void doInvokeBody()
          Actually invoke the tag body to generate the SAX events
 org.xml.sax.ContentHandler getContentHandler()
          Gets the SAX ContentHandler to feed SAX events into
 org.xml.sax.DTDHandler getDTDHandler()
          Gets the DTD Handler to feed SAX events into
 org.xml.sax.EntityResolver getEntityResolver()
          Gets the Entity Resolver to feed SAX events into
 org.xml.sax.ErrorHandler getErrorHandler()
          Gets the Error Handler to feed SAX events into
 boolean getFeature(java.lang.String name)
          Lookup the value of a feature
 java.lang.Object getProperty(java.lang.String name)
          Lookup the value of a property
 void parse(org.xml.sax.InputSource input)
          Parse an XML source.
 void parse(java.lang.String systemId)
          Parse an XML source specified by a system id
 void setContentHandler(org.xml.sax.ContentHandler contentHandler)
          Sets the SAX ContentHandler to feed SAX events into
 void setDTDHandler(org.xml.sax.DTDHandler dtdHandler)
          Sets the DTD Handler to feed SAX events into
 void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
          Sets the Entity Resolver to feed SAX events into
 void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
          Sets the Error Handler to feed SAX events into
 void setFeature(java.lang.String name, boolean value)
          Set the value of a feature
 void setProperty(java.lang.String name, java.lang.Object value)
          Set the value of a property
private  boolean shouldParseBody()
          Helper method to determin if nested body needs to be parsed by (an xml parser, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tag

private org.apache.commons.jelly.Tag tag
The tag whose body is to be read.


xmlOutput

private org.apache.commons.jelly.XMLOutput xmlOutput
The destination for the sax events generated by the reader.


dtdHandler

private org.xml.sax.DTDHandler dtdHandler
Storage for a DTDHandler if set by the user of the reader.


errorHandler

private org.xml.sax.ErrorHandler errorHandler
Storage for a ErrorHandler if set by the user of the reader.


entityResolver

private org.xml.sax.EntityResolver entityResolver
Storage for a EntityResolver if set by the user of the reader.

Constructor Detail

TransformTag.TagBodyXMLReader

public TransformTag.TagBodyXMLReader(org.apache.commons.jelly.Tag tag)
Construct an XMLReader for the specified Tag

Parameters:
tag - The Tag to convert to an XMLReader
Method Detail

parse

public void parse(org.xml.sax.InputSource input)
           throws java.io.IOException,
                  org.xml.sax.SAXException
Parse an XML source.

Specified by:
parse in interface org.xml.sax.XMLReader
Parameters:
input - The source of the xml
Throws:
org.xml.sax.SAXException - - Any SAX exception, possibly wrapping another exception.
java.io.IOException - - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.

parse

public void parse(java.lang.String systemId)
           throws java.io.IOException,
                  org.xml.sax.SAXException
Parse an XML source specified by a system id

Specified by:
parse in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXException - - Any SAX exception, possibly wrapping another exception.
java.io.IOException - - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.

doInvokeBody

private void doInvokeBody()
                   throws org.xml.sax.SAXException
Actually invoke the tag body to generate the SAX events

Throws:
org.xml.sax.SAXException - - Any SAX exception, possibly wrapping another exception.

shouldParseBody

private boolean shouldParseBody()
                         throws org.apache.commons.jelly.JellyTagException
Helper method to determin if nested body needs to be parsed by (an xml parser, i.e. its only text) to generate SAX events or not

Returns:
True if tag body should be parsed or false if invoked only
Throws:
org.apache.commons.jelly.JellyTagException

getContentHandler

public org.xml.sax.ContentHandler getContentHandler()
Gets the SAX ContentHandler to feed SAX events into

Specified by:
getContentHandler in interface org.xml.sax.XMLReader
Returns:
the SAX ContentHandler to use to feed SAX events into

setContentHandler

public void setContentHandler(org.xml.sax.ContentHandler contentHandler)
Sets the SAX ContentHandler to feed SAX events into

Specified by:
setContentHandler in interface org.xml.sax.XMLReader
Parameters:
contentHandler - is the ContentHandler to use. This value cannot be null.

getDTDHandler

public org.xml.sax.DTDHandler getDTDHandler()
Gets the DTD Handler to feed SAX events into

Specified by:
getDTDHandler in interface org.xml.sax.XMLReader
Returns:
the DTD Handler to use to feed SAX events into

setDTDHandler

public void setDTDHandler(org.xml.sax.DTDHandler dtdHandler)
Sets the DTD Handler to feed SAX events into

Specified by:
setDTDHandler in interface org.xml.sax.XMLReader

getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()
Gets the Error Handler to feed SAX events into

Specified by:
getErrorHandler in interface org.xml.sax.XMLReader
Returns:
the Error Handler to use to feed SAX events into

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
Sets the Error Handler to feed SAX events into

Specified by:
setErrorHandler in interface org.xml.sax.XMLReader

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()
Gets the Entity Resolver to feed SAX events into

Specified by:
getEntityResolver in interface org.xml.sax.XMLReader
Returns:
the Entity Resolver to use to feed SAX events into

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
Sets the Entity Resolver to feed SAX events into

Specified by:
setEntityResolver in interface org.xml.sax.XMLReader

getProperty

public java.lang.Object getProperty(java.lang.String name)
                             throws org.xml.sax.SAXNotRecognizedException,
                                    org.xml.sax.SAXNotSupportedException
Lookup the value of a property

Specified by:
getProperty in interface org.xml.sax.XMLReader
Parameters:
name - - The property name, which is a fully-qualified URI.
Returns:
- The current value of the property.
Throws:
org.xml.sax.SAXNotRecognizedException - - When the XMLReader does not recognize the property name.
org.xml.sax.SAXNotSupportedException - - When the XMLReader recognizes the property name but cannot determine its value at this time.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
                 throws org.xml.sax.SAXNotRecognizedException,
                        org.xml.sax.SAXNotSupportedException
Set the value of a property

Specified by:
setProperty in interface org.xml.sax.XMLReader
Parameters:
name - - The property name, which is a fully-qualified URI.
value - - The property value
Throws:
org.xml.sax.SAXNotRecognizedException - - When the XMLReader does not recognize the property name.
org.xml.sax.SAXNotSupportedException - - When the XMLReader recognizes the property name but cannot determine its value at this time.

getFeature

public boolean getFeature(java.lang.String name)
                   throws org.xml.sax.SAXNotRecognizedException,
                          org.xml.sax.SAXNotSupportedException
Lookup the value of a feature

Specified by:
getFeature in interface org.xml.sax.XMLReader
Parameters:
name - - The feature name, which is a fully-qualified URI.
Returns:
- The current state of the feature (true or false)
Throws:
org.xml.sax.SAXNotRecognizedException - - When the XMLReader does not recognize the feature name.
org.xml.sax.SAXNotSupportedException - - When the XMLReader recognizes the feature name but cannot determine its value at this time.

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws org.xml.sax.SAXNotRecognizedException,
                       org.xml.sax.SAXNotSupportedException
Set the value of a feature

Specified by:
setFeature in interface org.xml.sax.XMLReader
Parameters:
name - - The feature name, which is a fully-qualified URI.
value - - The current state of the feature (true or false)
Throws:
org.xml.sax.SAXNotRecognizedException - - When the XMLReader does not recognize the feature name.
org.xml.sax.SAXNotSupportedException - - When the XMLReader recognizes the feature name but cannot determine its value at this time.