jd.xml.xslt.result
Class SaxResultBuilder

java.lang.Object
  extended byjd.xml.xslt.result.ResultBuilder
      extended byjd.xml.xslt.result.SaxResultBuilder

public class SaxResultBuilder
extends ResultBuilder

A SaxResultBuilder feeds the output into a Sax ContentHandler.


Constructor Summary
SaxResultBuilder(String uri, ContentHandler contentHandler)
          Create a SaxResultBuilder.
SaxResultBuilder(String uri, ContentHandler contentHandler, LexicalHandler lexicalHandler)
          Create a SaxResultBuilder.
 
Method Summary
 void addAttribute(String name, String prefix, String uri, String value)
          Add an attribute to the output.
 void addComment(String value)
          Add a comment to the output.
 void addNamespace(String prefix, String uri, boolean test)
          Add a namespace node to the output.
 void addProcessingInstruction(String target, String data)
          Add a processing instruction to the output.
 void addText(String text)
          Add text to the output.
 void addTextUnescaped(String text)
          Add text to the output.
 void endDocument()
          End the document output.
 void endElement()
          End an element output.
 ContentHandler getContentHandler()
          Return the ContentHandler.
 String getNamespacePrefix(String uri)
          Return the current namespace prefix of the namespace with the given uri
 void startDocument(OutputFormat outputFormat)
          Start the document.
 void startElement(String namespaceUri, String name, NamespaceContext namespaceContext, boolean isCDataSectionElement)
          Start an element output.
 
Methods inherited from class jd.xml.xslt.result.ResultBuilder
addAttribute, cleanup, convertException, getSubResultBuilder, getUri, startElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SaxResultBuilder

public SaxResultBuilder(String uri,
                        ContentHandler contentHandler)
Create a SaxResultBuilder.

Parameters:
uri - the document uri.
contentHandler - the contentHandler

SaxResultBuilder

public SaxResultBuilder(String uri,
                        ContentHandler contentHandler,
                        LexicalHandler lexicalHandler)
Create a SaxResultBuilder.

Parameters:
uri - the document uri.
contentHandler - the contentHandler
lexicalHandler - the lexicalHandler. Can be null.
Method Detail

getContentHandler

public ContentHandler getContentHandler()
Return the ContentHandler.


startDocument

public void startDocument(OutputFormat outputFormat)
Start the document.

Specified by:
startDocument in class ResultBuilder
Parameters:
outputFormat - the output format

endDocument

public void endDocument()
                 throws XsltException
End the document output.

Specified by:
endDocument in class ResultBuilder
Throws:
XsltException

startElement

public void startElement(String namespaceUri,
                         String name,
                         NamespaceContext namespaceContext,
                         boolean isCDataSectionElement)
Start an element output.

Specified by:
startElement in class ResultBuilder
Parameters:
namespaceUri - the namespace of the element or null if it has none
name - the element name
namespaceContext - the namespace context of the element.

endElement

public void endElement()
                throws XsltException
End an element output.

Specified by:
endElement in class ResultBuilder
Throws:
XsltException

addNamespace

public void addNamespace(String prefix,
                         String uri,
                         boolean test)
Add a namespace node to the output.

Specified by:
addNamespace in class ResultBuilder
Parameters:
prefix - the namespace prefix
uri - the namespace uri
test - flag if it should be tested that the namespace can be inserted in the output tree at this place.

getNamespacePrefix

public String getNamespacePrefix(String uri)
Return the current namespace prefix of the namespace with the given uri

Specified by:
getNamespacePrefix in class ResultBuilder
Returns:
the prefix or null if no such namespace is declared

addAttribute

public void addAttribute(String name,
                         String prefix,
                         String uri,
                         String value)
                  throws XsltException
Add an attribute to the output.

Specified by:
addAttribute in class ResultBuilder
Parameters:
name - the qname
prefix - the prefix
uri - the namespace uri
value - the value
Throws:
XsltException

addText

public void addText(String text)
Add text to the output.

Specified by:
addText in class ResultBuilder

addTextUnescaped

public void addTextUnescaped(String text)
Add text to the output.

Specified by:
addTextUnescaped in class ResultBuilder

addComment

public void addComment(String value)
                throws XsltException
Add a comment to the output.

Specified by:
addComment in class ResultBuilder
Throws:
XsltException

addProcessingInstruction

public void addProcessingInstruction(String target,
                                     String data)
                              throws XsltException
Add a processing instruction to the output.

Specified by:
addProcessingInstruction in class ResultBuilder
Throws:
XsltException