jd.xml.xslt.result
Class ResultTreeRecorder

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

public class ResultTreeRecorder
extends ResultBuilder

A ResultBuilder which records its method calls and can write them to another ResultBuilder.


Constructor Summary
ResultTreeRecorder()
           
 
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 value)
          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 without escaping.
 void endDocument()
          End the document output.
 void endElement()
          End an element output.
 String getNamespacePrefix(String uri)
          Return the current namespace prefix of the namespace with the given uri
 String getStringContent()
           
 ResultBuilder getSubResultBuilder(String uri, OutputFormat format)
          Create a ResultBuilder to output a subdocument.
 boolean isEmpty()
           
 void startDocument(OutputFormat outputFormat)
          Start the document output.
 void startElement(String namespaceUri, String name, NamespaceContext namespaceContext, boolean isCDataSectionElement)
          Start an element output.
 void writeTo(ResultBuilder builder)
          Write the recorded content to another ResultBuilder.
 
Methods inherited from class jd.xml.xslt.result.ResultBuilder
addAttribute, cleanup, convertException, getUri, startElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultTreeRecorder

public ResultTreeRecorder()
Method Detail

startDocument

public void startDocument(OutputFormat outputFormat)
Description copied from class: ResultBuilder
Start the document output.

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

endDocument

public void endDocument()
Description copied from class: ResultBuilder
End the document output.

Specified by:
endDocument in class ResultBuilder

startElement

public void startElement(String namespaceUri,
                         String name,
                         NamespaceContext namespaceContext,
                         boolean isCDataSectionElement)
Description copied from class: ResultBuilder
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()
Description copied from class: ResultBuilder
End an element output.

Specified by:
endElement in class ResultBuilder

addAttribute

public void addAttribute(String name,
                         String prefix,
                         String uri,
                         String value)
Description copied from class: ResultBuilder
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.

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

addNamespace

public void addNamespace(String prefix,
                         String uri,
                         boolean test)
Description copied from class: ResultBuilder
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)
Description copied from class: ResultBuilder
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

addComment

public void addComment(String value)
Description copied from class: ResultBuilder
Add a comment to the output.

Specified by:
addComment in class ResultBuilder

addProcessingInstruction

public void addProcessingInstruction(String target,
                                     String value)
Description copied from class: ResultBuilder
Add a processing instruction to the output.

Specified by:
addProcessingInstruction in class ResultBuilder

addText

public void addText(String text)
Description copied from class: ResultBuilder
Add text to the output.

Specified by:
addText in class ResultBuilder

addTextUnescaped

public void addTextUnescaped(String text)
Description copied from class: ResultBuilder
Add text to the output without escaping.

Specified by:
addTextUnescaped in class ResultBuilder

isEmpty

public boolean isEmpty()

getStringContent

public String getStringContent()

writeTo

public void writeTo(ResultBuilder builder)
Write the recorded content to another ResultBuilder.


getSubResultBuilder

public ResultBuilder getSubResultBuilder(String uri,
                                         OutputFormat format)
Description copied from class: ResultBuilder
Create a ResultBuilder to output a subdocument.

Overrides:
getSubResultBuilder in class ResultBuilder