com.jclark.xsl.sax2
Class ResultBase

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

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

abstract base class represents the results of executing a stylesheet Action -- constructs result components. events are fired to the Result, which may, in turn, fire events to a SAX ContHandler


Field Summary
(package private)  org.xml.sax.ErrorHandler _errorHandler
           
(package private)  OutputMethodHandler _outputMethodHandler
           
 
Constructor Summary
ResultBase(org.xml.sax.ContentHandler contentHandler, org.xml.sax.ErrorHandler errorHandler)
          Construct with a ContentHandler already determined
ResultBase(OutputMethodHandler outputMethodHandler, org.xml.sax.ErrorHandler errorHandler)
          Construct with an outputMethodHandler from which we'll obtain the appropriate ContentHandler
 
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)
          Notify the Element is ending
 void flush()
          call this when we're sure we're not getting any more attribute node constructing actions
protected  Name getAttributeName(int index)
           
protected  org.xml.sax.ContentHandler getContentHandler()
           
 int getIndex(java.lang.String qName)
           
 int getIndex(java.lang.String namespaceURI, java.lang.String localName)
          Attributes implementation: get the index of the Attribute with the given Name components, or -1 if it does not exist
 int getLength()
           
 java.lang.String getLocalName(int index)
          Attributes implementation: get the Attribute's local name
 java.lang.String getQName(int index)
           
 java.lang.String getType(int index)
           
 java.lang.String getType(java.lang.String qName)
           
 java.lang.String getType(java.lang.String namespaceURI, java.lang.String localName)
           
 java.lang.String getURI(int index)
          Attributes implementation: get the namespace for the i'th Attribute's name
 java.lang.String getValue(int index)
          Attributes implementation: get the value of the i'th Attribute
 java.lang.String getValue(java.lang.String qName)
          Attributes implementation: get the value of the named Attribute
 java.lang.String getValue(java.lang.String namespaceURI, java.lang.String localName)
          Attributes implementation: get the value of the Attribute with the given name in the given namespace the String value of the Attribute, or null if it does not exist
(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)
          Copy a Result Tree Fragment to the Destination via the Handler
(package private)  org.xml.sax.ContentHandler setOutputMethod(Name name, OutputMethod method)
          get the appropriate ContentHandler from the outputMethodHandler (we've already obtained for our destination) for the named output method
 void start(OutputMethod outputMethod)
          initialize, (and possibly construct) the ContentHandler called by the transformation engine
 void startElement(Name elementType, NamespacePrefixMap nsMap)
          start construction an Element ...
protected abstract  void startElementContent(Name elementType, NamespacePrefixMap nsMap)
          notify that 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
 

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 ContentHandler


ResultBase

ResultBase(org.xml.sax.ContentHandler contentHandler,
           org.xml.sax.ErrorHandler errorHandler)
Construct with a ContentHandler 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 ... we may yet get some attributes, so we'll wait a bit before propagating the event downstream

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

getContentHandler

protected final org.xml.sax.ContentHandler getContentHandler()

getIndex

public int getIndex(java.lang.String qName)
Specified by:
getIndex in interface org.xml.sax.Attributes

getIndex

public int getIndex(java.lang.String namespaceURI,
                    java.lang.String localName)
Attributes implementation: get the index of the Attribute with the given Name components, or -1 if it does not exist

Specified by:
getIndex in interface org.xml.sax.Attributes

getLength

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

getValue

public java.lang.String getValue(java.lang.String namespaceURI,
                                 java.lang.String localName)
Attributes implementation: get the value of the Attribute with the given name in the given namespace the String value of the Attribute, or null if it does not exist

Specified by:
getValue in interface org.xml.sax.Attributes

getValue

public java.lang.String getValue(int index)
Attributes implementation: get the value of the i'th Attribute

Specified by:
getValue in interface org.xml.sax.Attributes

getValue

public java.lang.String getValue(java.lang.String qName)
Attributes implementation: get the value of the named Attribute

Specified by:
getValue in interface org.xml.sax.Attributes

getURI

public java.lang.String getURI(int index)
Attributes implementation: get the namespace for the i'th Attribute's name

Specified by:
getURI in interface org.xml.sax.Attributes

getLocalName

public java.lang.String getLocalName(int index)
Attributes implementation: get the Attribute's local name

Specified by:
getLocalName in interface org.xml.sax.Attributes

getQName

public java.lang.String getQName(int index)
Specified by:
getQName in interface org.xml.sax.Attributes

getType

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

getType

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

getType

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

getAttributeName

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

startElementContent

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

Throws:
XSLException

endElementContent

protected abstract void endElementContent(Name elementType)
                                   throws XSLException
Notify the Element is ending

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

start

public void start(OutputMethod outputMethod)
           throws XSLException
initialize, (and possibly construct) the ContentHandler called by the transformation engine

Specified by:
start in interface Result
Parameters:
outputMethod - the xsl:output parameters gleaned from the stylesheet
Throws:
XSLException

resultTreeFragment

public abstract void resultTreeFragment(ResultTreeFragment frag)
                                 throws XSLException
Copy a Result Tree Fragment to the Destination via the Handler

Throws:
XSLException

setOutputMethod

org.xml.sax.ContentHandler setOutputMethod(Name name,
                                           OutputMethod method)
                                     throws java.io.IOException,
                                            org.xml.sax.SAXException
get the appropriate ContentHandler from the outputMethodHandler (we've already obtained for our destination) 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

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

grow

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

grow

static Name[] grow(Name[] v)