jd.xml.xslt.result
Class ResultBuilder

java.lang.Object
  extended byjd.xml.xslt.result.ResultBuilder
Direct Known Subclasses:
CanXmlResultBuilder, DomResultBuilder, EmptyResultBuilder, MarkupResultBuilder, ModelResultBuilder, ProxyResultBuilder, ResultTextRecorder, ResultTreeRecorder, SaxResultBuilder, TextResultBuilder

public abstract class ResultBuilder
extends Object

A ResultBuilder takes care for the output of a XSLT transformation.


Constructor Summary
ResultBuilder(String uri)
          Create a ResultBuilder.
 
Method Summary
 void addAttribute(String name, String value)
           
abstract  void addAttribute(String name, String prefix, String uri, String value)
          Add an attribute to the output.
abstract  void addComment(String value)
          Add a comment to the output.
abstract  void addNamespace(String prefix, String uri, boolean test)
          Add a namespace node to the output.
abstract  void addProcessingInstruction(String target, String data)
          Add a processing instruction to the output.
abstract  void addText(String text)
          Add text to the output.
abstract  void addTextUnescaped(String text)
          Add text to the output without escaping.
 void cleanup()
          Cleanup any resources.
protected  void convertException(Exception e)
          Convert a thrown exception to a XsltException.
abstract  void endDocument()
          End the document output.
abstract  void endElement()
          End an element output.
abstract  String getNamespacePrefix(String uri)
          Return the current namespace prefix of the namespace with the given uri
 ResultBuilder getSubResultBuilder(String href, OutputFormat outputFormat)
          Create a ResultBuilder to output a subdocument.
 String getUri()
          Return the document uri.
abstract  void startDocument(OutputFormat outputFormat)
          Start the document output.
 void startElement(String name)
          Start an element output.
abstract  void startElement(String namespaceUri, String name, NamespaceContext namespaceContext, boolean isCDataSectionElement)
          Start an element output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultBuilder

public ResultBuilder(String uri)
Create a ResultBuilder.

Parameters:
uri - the document uri.
Method Detail

getUri

public final String getUri()
Return the document uri.


startDocument

public abstract void startDocument(OutputFormat outputFormat)
                            throws XsltException
Start the document output.

Parameters:
outputFormat - the output format
Throws:
XsltException

endDocument

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

Throws:
XsltException

startElement

public void startElement(String name)
                  throws XsltException
Start an element output.

Throws:
XsltException

startElement

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

Parameters:
namespaceUri - the namespace of the element or null if it has none
name - the element name
namespaceContext - the namespace context of the element.
Throws:
XsltException

endElement

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

Throws:
XsltException

addNamespace

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

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.
Throws:
XsltException

getNamespacePrefix

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

Returns:
the prefix or null if no such namespace is declared

addAttribute

public abstract void addAttribute(String name,
                                  String prefix,
                                  String uri,
                                  String value)
                           throws XsltException
Add an attribute to the output. If the namespace uri is not null, then the ResultBuilder has to check if the prefix is correct: If the prefix is null or already used by another namespace declaration, then the ResultBuilder has to assign a value to the prefix and adjust the name of the attribute.

Parameters:
name - the qname
prefix - the prefix
uri - the namespace uri
value - the value
Throws:
XsltException

addAttribute

public void addAttribute(String name,
                         String value)
                  throws XsltException
Throws:
XsltException

addText

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

Throws:
XsltException

addTextUnescaped

public abstract void addTextUnescaped(String text)
                               throws XsltException
Add text to the output without escaping.

Throws:
XsltException

addComment

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

Throws:
XsltException

addProcessingInstruction

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

Throws:
XsltException

getSubResultBuilder

public ResultBuilder getSubResultBuilder(String href,
                                         OutputFormat outputFormat)
Create a ResultBuilder to output a subdocument.


cleanup

public void cleanup()
Cleanup any resources.


convertException

protected void convertException(Exception e)
                         throws XsltException
Convert a thrown exception to a XsltException.

Throws:
XsltException