com.jclark.xsl.sax
Class ResultBase

java.lang.Object
  extended by com.jclark.xsl.sax.ResultBase
All Implemented Interfaces:
Result, org.xml.sax.AttributeList
Direct Known Subclasses:
MultiNamespaceResult

public abstract class ResultBase
extends java.lang.Object
implements Result, org.xml.sax.AttributeList

abstract base class represents the results of executing a stylesheet Action -- constructs result components. events are fired to the Result, which in turn fires events to a SAX (1) DocumentHandler


Field Summary
(package private)  org.xml.sax.ErrorHandler errorHandler
           
(package private)  OutputMethodHandler outputMethodHandler
           
 
Constructor Summary
ResultBase(org.xml.sax.DocumentHandler documentHandler, org.xml.sax.ErrorHandler errorHandler)
          Construct with a DocummentHandler already determined
ResultBase(OutputMethodHandler outputMethodHandler, org.xml.sax.ErrorHandler errorHandler)
          Construct with an outputMethodHandler from which we'll obtain the appropriate DocumentHandler
 
Method Summary
 void attribute(Name name, java.lang.String value)
          construct an Attribute with the given name ...
 void characters(java.lang.String str)
          construct some characters in the result
 void comment(java.lang.String str)
          construct a comment in our result
 void end()
          flush any pending construction work, nothing else will be built
 void endElement(Name elementType)
          Finish constructing an Element
protected abstract  void endElementContent(Name elementType)
           
 void flush()
          call this when we're sure we're not getting any more attribute node constructing actions
protected  Name getAttributeName(int i)
           
protected  org.xml.sax.DocumentHandler getDocumentHandler()
           
 int getLength()
           
 java.lang.String getType(int i)
           
 java.lang.String getType(java.lang.String name)
           
 java.lang.String getValue(int i)
           
 java.lang.String getValue(java.lang.String name)
           
(package private) static Name[] grow(Name[] v)
           
(package private) static java.lang.String[] grow(java.lang.String[] v)
           
 void message(Node node, java.lang.String str)
          Support the xsl:message element.
 void processingInstruction(java.lang.String target, java.lang.String data)
          construct a processingInstruction in the result
 void rawCharacters(java.lang.String str)
          rawCharacters are distinct from plain 'ol characters in that we don't try to do any escaping
abstract  void resultTreeFragment(ResultTreeFragment frag)
           
(package private)  org.xml.sax.DocumentHandler setOutputMethod(Name name, OutputMethod method)
          get the appropriate DocumentHandler from the outputMethodHandler (we've already obtained for our destiantion) for the named output method
 void start(OutputMethod outputMethod)
          initialize, (and possibly construct) the DocumentHandler
 void startElement(Name elementType, NamespacePrefixMap nsMap)
          start construction an Element
protected abstract  void startElementContent(Name elementType, NamespacePrefixMap nsMap)
          we're finished with adding attributes?
protected  void throwXSLException(org.xml.sax.SAXException e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jclark.xsl.tr.Result
createResult
 
Methods inherited from interface org.xml.sax.AttributeList
getName
 

Field Detail

errorHandler

org.xml.sax.ErrorHandler errorHandler

outputMethodHandler

OutputMethodHandler outputMethodHandler
Constructor Detail

ResultBase

ResultBase(OutputMethodHandler outputMethodHandler,
           org.xml.sax.ErrorHandler errorHandler)
Construct with an outputMethodHandler from which we'll obtain the appropriate DocumentHandler


ResultBase

ResultBase(org.xml.sax.DocumentHandler documentHandler,
           org.xml.sax.ErrorHandler errorHandler)
Construct with a DocummentHandler already determined

Method Detail

flush

public void flush()
           throws XSLException
call this when we're sure we're not getting any more attribute node constructing actions

Throws:
XSLException

rawCharacters

public void rawCharacters(java.lang.String str)
                   throws XSLException
rawCharacters are distinct from plain 'ol characters in that we don't try to do any escaping

Specified by:
rawCharacters in interface Result
Throws:
XSLException

characters

public void characters(java.lang.String str)
                throws XSLException
construct some characters in the result

Specified by:
characters in interface Result
Throws:
XSLException

comment

public void comment(java.lang.String str)
             throws XSLException
construct a comment in our result

Specified by:
comment in interface Result
Throws:
XSLException

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws XSLException
construct a processingInstruction in the result

Specified by:
processingInstruction in interface Result
Throws:
XSLException

startElement

public void startElement(Name elementType,
                         NamespacePrefixMap nsMap)
                  throws XSLException
start construction an Element

Specified by:
startElement in interface Result
Throws:
XSLException

endElement

public void endElement(Name elementType)
                throws XSLException
Description copied from interface: Result
Finish constructing an Element

Specified by:
endElement in interface Result
Throws:
XSLException

getDocumentHandler

protected final org.xml.sax.DocumentHandler getDocumentHandler()

getLength

public int getLength()
Specified by:
getLength in interface org.xml.sax.AttributeList
Returns:
the number of attribute nodes we have at this moment

getAttributeName

protected final Name getAttributeName(int i)
Returns:
the name of the i'th Attribute

getValue

public java.lang.String getValue(int i)
Specified by:
getValue in interface org.xml.sax.AttributeList
Returns:
the value of the i'th Attribute

getType

public java.lang.String getType(int i)
Specified by:
getType in interface org.xml.sax.AttributeList
Returns:
the type of the i'th Attribute (always "CDATA")

getType

public java.lang.String getType(java.lang.String name)
Specified by:
getType in interface org.xml.sax.AttributeList
Returns:
the type of the named Attribute (always "CDATA")

getValue

public java.lang.String getValue(java.lang.String name)
Specified by:
getValue in interface org.xml.sax.AttributeList
Returns:
the value of the named Attribute (always "CDATA") .. not sure how these names work with namespaces returns null if the named Attribute is not found

startElementContent

protected abstract void startElementContent(Name elementType,
                                            NamespacePrefixMap nsMap)
                                     throws XSLException
we're finished with adding attributes?

Throws:
XSLException

endElementContent

protected abstract void endElementContent(Name elementType)
                                   throws XSLException
Throws:
XSLException

attribute

public void attribute(Name name,
                      java.lang.String value)
               throws XSLException
construct an Attribute with the given name ... if we're not at an appropriate point, eg, we've already started putting text into an element, do nothing

Specified by:
attribute in interface Result
Throws:
XSLException

grow

static java.lang.String[] grow(java.lang.String[] v)

grow

static Name[] grow(Name[] v)

start

public void start(OutputMethod outputMethod)
           throws XSLException
initialize, (and possibly construct) the DocumentHandler

Specified by:
start in interface Result
Parameters:
outputMethod - whatever the stylesheeet has told us about how it wants the trasnformed results output
Throws:
XSLException

setOutputMethod

org.xml.sax.DocumentHandler setOutputMethod(Name name,
                                            OutputMethod method)
                                      throws java.io.IOException,
                                             org.xml.sax.SAXException
get the appropriate DocumentHandler from the outputMethodHandler (we've already obtained for our destiantion) for the named output method

Throws:
java.io.IOException
org.xml.sax.SAXException

end

public void end()
         throws XSLException
flush any pending construction work, nothing else will be built

Specified by:
end in interface Result
Throws:
XSLException

throwXSLException

protected void throwXSLException(org.xml.sax.SAXException e)
                          throws XSLException
Throws:
XSLException

resultTreeFragment

public abstract void resultTreeFragment(ResultTreeFragment frag)
                                 throws XSLException
Throws:
XSLException

message

public void message(Node node,
                    java.lang.String str)
             throws XSLException
Description copied from interface: Result
Support the xsl:message element.

Specified by:
message in interface Result
Parameters:
node - The source context node under consideration when the message action is performed. May be used for locator information
Throws:
XSLException