All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class vnet.markup.MarkupWriter

java.lang.Object
   |
   +----vnet.markup.MarkupWriter

public class MarkupWriter
extends Object
A wrapper class to output a Document to a Writer in a one-shot or incremental fasion, or a misture of both.


Variable Index

 o elements
Keeps track of incr elements.
 o marks
Tracks incr marks.
 o writer
A writer to write output to.

Constructor Index

 o MarkupWriter(Writer, Document)
Constructs a new MarkupWriter.

Method Index

 o setMark()
Adds a mark to the current element (added with writeFullIncr() or writeShortIncr()).
 o writeComment(Comment)
Writes the specified comment immediately.
 o writeImmediate(MarkupNode)
Writes the MarkupNode and any children, recursively.
 o writeIncrement(Element)
Writes the element's start tag and any children (if present).
 o writeIncrToElement(Element)
Write's the passed Element's end tag and that of any of the element's child elements which have not yet had end tags written.
 o writeToMark()
Writes up to and including the end tag of the previously marked element.

Variables

 o writer
 protected Writer writer
A writer to write output to.

 o elements
 protected Stack elements
Keeps track of incr elements.

 o marks
 protected Stack marks
Tracks incr marks.

Constructors

 o MarkupWriter
 public MarkupWriter(Writer writer,
                     Document doc) throws IOException
Constructs a new MarkupWriter.

Parameters:
writer - the non-null writer to send output to.
document - the non-null base Document.
Throws: IOException
thrown if an IO error occurs.

Methods

 o writeImmediate
 public void writeImmediate(MarkupNode node) throws IOException, NullPointerException
Writes the MarkupNode and any children, recursively.

Parameters:
node - non-null MarkupNode to write
Throws: IOException
thrown if an IO error occurs
Throws: NullPointerException
if node is null
 o writeIncrement
 public void writeIncrement(Element element) throws IOException, NullPointerException
Writes the element's start tag and any children (if present). Note that for non-"empty" elements, because the end tag is not written, any additional writes will be as children of this node, until it is closed with setIncrMark()/writeToIncrMark() or writeIncrToElement(). Empty elements do not have end tags and so are closed immediately.

Parameters:
element - non-null Element to write
Throws: IOException
thrown if an IO error occurs
Throws: NullPointerException
if element is null
See Also:
setIncrMark, writeToIncrMark, writeIncrToElement
 o writeIncrToElement
 public void writeIncrToElement(Element element) throws IOException
Write's the passed Element's end tag and that of any of the element's child elements which have not yet had end tags written. elements

Parameters:
element - The element to close. If the value passes is null or is not in the stack, the entire document will be closed.
Throws: IOException
thrown if an IO error occurs.
 o setMark
 public void setMark() throws EmptyStackException
Adds a mark to the current element (added with writeFullIncr() or writeShortIncr()).

Throws: EmptyStackException
thrown if there is no curent element
See Also:
writeToMark
 o writeToMark
 public void writeToMark() throws IOException
Writes up to and including the end tag of the previously marked element.

Throws: IOException
thrown if an IO error occurs.
See Also:
setMark
 o writeComment
 public void writeComment(Comment comment) throws IOException, NullPointerException
Writes the specified comment immediately.

Parameters:
comment - non-null Comment to write
Throws: IOException
thrown if an IO error occurs
Throws: NullPointerException
if comment is null

All Packages  Class Hierarchy  This Package  Previous  Next  Index