org.exolab.adaptx.xslt.util
Class ResultFormatter

java.lang.Object
  extended by org.exolab.adaptx.util.ErrorObserverAdapter
      extended by org.exolab.adaptx.xslt.util.ResultFormatter
All Implemented Interfaces:
ErrorObserver

public class ResultFormatter
extends ErrorObserverAdapter

The ResultFormatter class used by the RuleProcessor to send results to. This class wraps a ResultHandler and does some common processing, such as namespace management.

Version:
$Revision: 3633 $ $Date: 2003-03-01 02:38:44 -0500 (Sat, 01 Mar 2003) $
Author:
Keith Visco

Field Summary
 
Fields inherited from interface org.exolab.adaptx.util.ErrorObserver
FATAL, NORMAL, WARNING
 
Constructor Summary
ResultFormatter(ResultHandler handler)
          Creates a new ResultFormatter using the given ResultHandler
 
Method Summary
 void attribute(java.lang.String name, java.lang.String value, java.lang.String nsURI)
          Adds the given attribute to the result tree if attributes are allowed at the given time
 boolean attsAllowed()
          Returns true if an attribute can be successfully added to the current node.
 void cdata(char[] chars, int start, int length)
          Signals a block of CDATA content.
 void cdata(java.lang.String data)
          Signals a block of CDATA content.
 void characters(char[] chars, int start, int length)
          Signals a block of character content.
 void characters(java.lang.String data)
          Signals a block of character content.
 void comment(java.lang.String data)
          Signals to recieve a comment.
 void declareNamespace(java.lang.String prefix, java.lang.String uri)
          Declares the given namespace, the namespace will be added to the next element.
 void endElement(java.lang.String name, java.lang.String nsURI)
          Signals the end of the current element.
 void entityReference(java.lang.String name)
          Signals to recieve an entity reference with the given name.
 void flush()
          The processor state doesn't always send data to the Formatter, until necessary.
 ResultHandler getResultHandler()
          Returns the ResultHandler being used by this ResultFormatter.
 void ignorableWhitespace(char[] chars, int start, int length)
          Signals the start of ignorable whitespace characters.
 boolean isNamespaceDeclared(java.lang.String namespace)
          Returns true if the given namespace has been declared.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Signals to receive the processing instruction.
 void startElement(java.lang.String name, java.lang.String nsURI)
          Signals the start of an element.
 void unescapedCharacters(char[] chars, int start, int length)
          Signals to receive characters which should not be escaped.
 void unescapedCharacters(java.lang.String data)
          Signals to receive characters which should not be escaped.
 
Methods inherited from class org.exolab.adaptx.util.ErrorObserverAdapter
addErrorObserver, receiveError, receiveError, receiveError, receiveError, receiveError, receiveError, removeAllErrorObservers, removeErrorObserver
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultFormatter

public ResultFormatter(ResultHandler handler)
Creates a new ResultFormatter using the given ResultHandler

Parameters:
handler - the ResultHandler to send data to
Method Detail

attribute

public void attribute(java.lang.String name,
                      java.lang.String value,
                      java.lang.String nsURI)
Adds the given attribute to the result tree if attributes are allowed at the given time

Parameters:
name - the name of the attribute
value - the value of the attribute

attsAllowed

public boolean attsAllowed()
Returns true if an attribute can be successfully added to the current node.

Returns:
true if an attribute can be successfully added to the current node.

cdata

public void cdata(java.lang.String data)
Signals a block of CDATA content.

Parameters:
data - the CDATA section content

cdata

public void cdata(char[] chars,
                  int start,
                  int length)
Signals a block of CDATA content.

Parameters:
chars - a char[] containing the CDATA section content
start - the start offset into the char[]
length - the number of characters

characters

public void characters(java.lang.String data)
Signals a block of character content.

Parameters:
data - the character content

characters

public void characters(char[] chars,
                       int start,
                       int length)
Signals a block of character content.

Parameters:
chars - a char[] containing the characters
start - the starting index into the char[]
length - the number of characters

comment

public void comment(java.lang.String data)
Signals to recieve a comment.

Parameters:
data, - the content of the comment

declareNamespace

public void declareNamespace(java.lang.String prefix,
                             java.lang.String uri)
Declares the given namespace, the namespace will be added to the next element.


endElement

public void endElement(java.lang.String name,
                       java.lang.String nsURI)
Signals the end of the current element.

Parameters:
name - the name of the element

entityReference

public void entityReference(java.lang.String name)
Signals to recieve an entity reference with the given name.

Parameters:
name - the name of the entity reference

flush

public void flush()
The processor state doesn't always send data to the Formatter, until necessary. This method will force a "flush" of any saved data.


getResultHandler

public ResultHandler getResultHandler()
Returns the ResultHandler being used by this ResultFormatter.

Returns:
the ResultHandler being used by this ResultFormatter

ignorableWhitespace

public void ignorableWhitespace(char[] chars,
                                int start,
                                int length)
Signals the start of ignorable whitespace characters.

Parameters:
chars - the character array containing the characters to receive
start - the index into the character array to start receiving characters at
length - the number of characters to recieve

isNamespaceDeclared

public boolean isNamespaceDeclared(java.lang.String namespace)
Returns true if the given namespace has been declared.

Parameters:
namespace - the namespace to check the declaration for
Returns:
true if the given namespace has been declared

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
Signals to receive the processing instruction.

Parameters:
target -
data -

startElement

public void startElement(java.lang.String name,
                         java.lang.String nsURI)
Signals the start of an element.

Parameters:
name - the name of the element, this must be the local name of the element. Any prefixes will be automatically stripped.

unescapedCharacters

public void unescapedCharacters(java.lang.String data)
Signals to receive characters which should not be escaped.

Parameters:
data - the character data to receive

unescapedCharacters

public void unescapedCharacters(char[] chars,
                                int start,
                                int length)
Signals to receive characters which should not be escaped.

Parameters:
chars - the character array containing the characters to receive
start - the index into the character array to start receiving characters at
length - the number of characters to recieve