com.novell.xsl.result
Class TextResultHandler

java.lang.Object
  extended bycom.novell.xsl.result.TextResultHandler
All Implemented Interfaces:
ResultHandler

public class TextResultHandler
extends Object
implements ResultHandler

A result handler that returns the concatenation of a result tree's text nodes. Any attempt to add a non-text node to the result tree causes an IllegalNodeException to be thrown.

This handler is used to instantiate templates that are allowed to create only text nodes. There are three such templates in the 16-Dec-98 draft: xsl:attribute, xsl:comment, and xsl:pi.


Constructor Summary
TextResultHandler()
          Constructs a new text result handler.
 
Method Summary
 void attribute(String name, String value)
          Receive notification of an attribute.
 void characters(String data)
          Receive notification of character data.
 void comment(String value)
          Receive notification of a comment.
 void endDocument()
          Receive notification of the end of a document.
 void endElement(String name)
          Receive notification of the end of an element.
 String getText()
          Returns the result tree's text.
 void namespace(String name, NamespaceName value)
          Receive notification of a namespace node.
 void processingInstruction(String target, String value)
          Receive notification of a processing instruction.
 void startDocument()
          Receive notification of the beginning of a document.
 void startElement(String name, String namespaceURI)
          Receive notification of the beginning of an element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextResultHandler

public TextResultHandler()
Constructs a new text result handler.

Method Detail

getText

public String getText()
Returns the result tree's text.

Returns:
the concatenation of the result tree's text nodes

startDocument

public void startDocument()
                   throws ResultException
Description copied from interface: ResultHandler
Receive notification of the beginning of a document.

Specified by:
startDocument in interface ResultHandler
Throws:
ResultException - if an implementation-dependent error occurs

endDocument

public void endDocument()
                 throws ResultException
Description copied from interface: ResultHandler
Receive notification of the end of a document.

Specified by:
endDocument in interface ResultHandler
Throws:
ResultException - if an implementation-dependent error occurs

startElement

public void startElement(String name,
                         String namespaceURI)
                  throws IllegalNameException,
                         IllegalNodeException,
                         ResultException
Receive notification of the beginning of an element.

Specified by:
startElement in interface ResultHandler
Parameters:
name - the element's name
namespaceURI - the element's namespace uri
Throws:
IllegalNodeException - always thrown since only text nodes are allowed
IllegalNameException - if the specified element name is illegal
ResultException - if an implementation-dependent error occurs

endElement

public void endElement(String name)
                throws ResultException
Description copied from interface: ResultHandler
Receive notification of the end of an element.

Specified by:
endElement in interface ResultHandler
Throws:
ResultException - if an implementation-dependent error occurs

attribute

public void attribute(String name,
                      String value)
               throws AttributeAfterChildException,
                      IllegalNameException,
                      IllegalNodeException,
                      ResultException
Receive notification of an attribute.

Specified by:
attribute in interface ResultHandler
Parameters:
name - the attribute's name
value - the attribute's value
Throws:
IllegalNodeException - always thrown since only text nodes are allowed
AttributeAfterChildException - if the current node is an element with children (attributes cannot be added to an element after children have been added to it)
IllegalNameException - if the specified attribute name is illegal
ResultException - if an implementation-dependent error occurs

characters

public void characters(String data)
                throws IllegalNodeException,
                       ResultException
Description copied from interface: ResultHandler
Receive notification of character data.

Specified by:
characters in interface ResultHandler
Parameters:
data - the character data
Throws:
ResultException - if an implementation-dependent error occurs
IllegalNodeException - if the current node cannot contain character data

processingInstruction

public void processingInstruction(String target,
                                  String value)
                           throws IllegalNameException,
                                  IllegalNodeException,
                                  ResultException
Receive notification of a processing instruction.

Specified by:
processingInstruction in interface ResultHandler
Parameters:
target - the processing instruction's target
value - the processing instruction's value, or null if there is no value
Throws:
IllegalNodeException - always thrown since only text nodes are allowed
ResultException - if an implementation-dependent error occurs
IllegalNameException - if the specified target name is illegal

comment

public void comment(String value)
             throws IllegalNodeException,
                    ResultException
Receive notification of a comment.

Specified by:
comment in interface ResultHandler
Parameters:
value - the comment's value
Throws:
IllegalNodeException - always thrown since only text nodes are allowed
ResultException - if an implementation-dependent error occurs

namespace

public void namespace(String name,
                      NamespaceName value)
               throws IllegalNodeException,
                      ResultException
Receive notification of a namespace node.

Specified by:
namespace in interface ResultHandler
Parameters:
name - the namespace prefix
value - the namespace name (URI)
Throws:
IllegalNodeException - always thrown since only text nodes are allowed
ResultException - if an implementation-dependent error occurs