jd.xml.xslt.result
Class MarkupResultBuilder

java.lang.Object
  extended byjd.xml.xslt.result.ResultBuilder
      extended byjd.xml.xslt.result.MarkupResultBuilder
Direct Known Subclasses:
HtmlResultBuilder, XmlResultBuilder

public abstract class MarkupResultBuilder
extends ResultBuilder

A base class ResultBuilders which output a markup stream.


Field Summary
protected  AttributeList attributes_
           
protected static int BUFFER_SIZE
           
protected  boolean elementStarted_
           
protected  Encoding encoding_
           
protected  boolean indent_
           
protected static int MAX_POS
           
protected  NamespaceSupport nsSupport_
           
protected  boolean outAutoFlush_
           
protected  boolean outNewLine_
           
protected  Output output_
           
protected  OutputFormat outputFormat_
           
protected  XsltResult result_
           
protected static Encoding UTF_8
           
 
Constructor Summary
MarkupResultBuilder(XsltResult result)
          Create a new XmlResultBuilder.
 
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 cleanup()
          Closes the outputstream if requested at construction time.
protected  void decreasePrintIndent()
           
 void endDocument()
          End the document output.
protected abstract  void flushNode(boolean addContent)
           
 String getNamespacePrefix(String uri)
          Return the current namespace prefix of the namespace with the given uri
protected  void increasePrintIndent()
           
protected  void printAttribute(String name, String value)
           
protected  int printCharReference(char c, String text, int i, int length)
           
protected  boolean printCharReference(int c, int next)
           
protected  void printIndent()
           
protected abstract  void printLineBreak()
           
protected  void println()
           
 void startDocument(OutputFormat outputFormat)
          Start the document output.
 
Methods inherited from class jd.xml.xslt.result.ResultBuilder
addAttribute, addProcessingInstruction, addText, addTextUnescaped, convertException, endElement, getSubResultBuilder, getUri, startElement, startElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UTF_8

protected static final Encoding UTF_8

BUFFER_SIZE

protected static final int BUFFER_SIZE
See Also:
Constant Field Values

MAX_POS

protected static final int MAX_POS
See Also:
Constant Field Values

outputFormat_

protected OutputFormat outputFormat_

result_

protected XsltResult result_

encoding_

protected Encoding encoding_

outNewLine_

protected boolean outNewLine_

outAutoFlush_

protected boolean outAutoFlush_

indent_

protected boolean indent_

elementStarted_

protected boolean elementStarted_

output_

protected Output output_

nsSupport_

protected NamespaceSupport nsSupport_

attributes_

protected AttributeList attributes_
Constructor Detail

MarkupResultBuilder

public MarkupResultBuilder(XsltResult result)
Create a new XmlResultBuilder.

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()
End the document output.

Specified by:
endDocument in class ResultBuilder

addComment

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

Specified by:
addComment in class ResultBuilder

addAttribute

public void addAttribute(String name,
                         String prefix,
                         String uri,
                         String value)
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

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

cleanup

public void cleanup()
Closes the outputstream if requested at construction time.

Overrides:
cleanup in class ResultBuilder

println

protected final void println()

printAttribute

protected final void printAttribute(String name,
                                    String value)

printCharReference

protected final boolean printCharReference(int c,
                                           int next)

printCharReference

protected final int printCharReference(char c,
                                       String text,
                                       int i,
                                       int length)
Parameters:
c - the current character == text.charAt(i)

printIndent

protected final void printIndent()

increasePrintIndent

protected final void increasePrintIndent()

decreasePrintIndent

protected final void decreasePrintIndent()

printLineBreak

protected abstract void printLineBreak()

flushNode

protected abstract void flushNode(boolean addContent)