com.jclark.xsl.sax2

Class ResultBase

Implemented Interfaces:
Attributes, Result
Known Direct Subclasses:
MultiNamespaceResult

public abstract class ResultBase
extends java.lang.Object
implements Result, 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) ErrorHandler
_errorHandler
(package private) OutputMethodHandler
_outputMethodHandler

Constructor Summary

ResultBase(ContentHandler contentHandler, ErrorHandler errorHandler)
Construct with a ContentHandler already determined
ResultBase(OutputMethodHandler outputMethodHandler, ErrorHandler errorHandler)
Construct with an outputMethodHandler from which we'll obtain the appropriate ContentHandler

Method Summary

void
attribute(Name name, String value)
construct an Attribute with the given Name ...
void
characters(String str)
construct some characters in the result
void
comment(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 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 ContentHandler
getContentHandler()
int
getIndex(String qName)
int
getIndex(String namespaceURI, String localName)
Attributes implementation: get the index of the Attribute with the given Name components, or null if it does not exist
int
getLength()
String
getLocalName(int index)
Attributes implementation: get the Attribute's local name
String
getQName(int index)
String
getType(String qName)
String
getType(String namespaceURI, String localName)
String
getType(int index)
String
getURI(int index)
Attributes implementation: get the namespace for the i'th Attribute's name
String
getValue(String qName)
Attributes implementation: get the value of the named Attribute
String
getValue(String namespaceURI, 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
String
getValue(int index)
Attributes implementation: get the value of the i'th Attribute
(package private) static String[]
grow(String[] v)
(package private) static Name[]
grow(Name[] v)
void
message(Node node, String str)
void
processingInstruction(String target, String data)
construct a processingInstruction in the result
void
rawCharacters(String str)
rawCharacters are distinct from plain 'ol characters in that we don't try to do any escaping
void
resultTreeFragment(ResultTreeFragment frag)
Copy a Result Tree Fragment to the Destination via the Handler
(package private) 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 void
startElementContent(Name elementType, NamespacePrefixMap nsMap)
notify that we're finished with adding attributes
protected void
throwXSLException(SAXException e)

Field Details

_errorHandler

(package private)  ErrorHandler _errorHandler


_outputMethodHandler

(package private)  OutputMethodHandler _outputMethodHandler

Constructor Details

ResultBase

(package private)  ResultBase(ContentHandler contentHandler,
                              ErrorHandler errorHandler)
Construct with a ContentHandler already determined


ResultBase

(package private)  ResultBase(OutputMethodHandler outputMethodHandler,
                              ErrorHandler errorHandler)
Construct with an outputMethodHandler from which we'll obtain the appropriate ContentHandler

Method Details

attribute

public void attribute(Name name,
                      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


characters

public void characters(String str)
            throws XSLException
construct some characters in the result
Specified by:
characters in interface Result


comment

public void comment(String str)
            throws XSLException
construct a comment in our result
Specified by:
comment in interface Result


end

public void end()
            throws XSLException
flush any pending construction work, nothing else will be built
Specified by:
end in interface Result


endElement

public void endElement(Name elementType)
            throws XSLException
Finish constructing an Element
Specified by:
endElement in interface Result


endElementContent

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


flush

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


getAttributeName

protected final Name getAttributeName(int index)

Returns:
the name of the i'th Attribute


getContentHandler

protected final ContentHandler getContentHandler()


getIndex

public int getIndex(String qName)


getIndex

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


getLength

public int getLength()

Returns:
the number of attribute nodes we have at this moment


getLocalName

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


getQName

public String getQName(int index)


getType

public String getType(String qName)

Returns:
the type of the named Attribute (always "CDATA")


getType

public String getType(String namespaceURI,
                      String localName)

Returns:
the type of the named Attribute (always "CDATA")


getType

public String getType(int index)

Returns:
the type of the i'th Attribute (always "CDATA")


getURI

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


getValue

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


getValue

public String getValue(String namespaceURI,
                       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


getValue

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


grow

(package private) static String[] grow(String[] v)


grow

(package private) static Name[] grow(Name[] v)


message

public void message(Node node,
                    String str)
            throws XSLException
Specified by:
message in interface Result


processingInstruction

public void processingInstruction(String target,
                                  String data)
            throws XSLException
construct a processingInstruction in the result
Specified by:
processingInstruction in interface Result


rawCharacters

public void rawCharacters(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


resultTreeFragment

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


setOutputMethod

(package private)  ContentHandler setOutputMethod(Name name,
                                                  OutputMethod method)
            throws IOException,
                   SAXException
get the appropriate ContentHandler from the outputMethodHandler (we've already obtained for our destination) for the named output method


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


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


startElementContent

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


throwXSLException

protected void throwXSLException(SAXException e)
            throws XSLException