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.
-
elements
- Keeps track of incr elements.
-
marks
- Tracks incr marks.
-
writer
- A writer to write output to.
-
MarkupWriter(Writer, Document)
- Constructs a new MarkupWriter.
-
setMark()
- Adds a mark to the current element (added with writeFullIncr() or
writeShortIncr()).
-
writeComment(Comment)
- Writes the specified comment immediately.
-
writeImmediate(MarkupNode)
- Writes the MarkupNode and any children, recursively.
-
writeIncrement(Element)
- Writes the element's start tag and any children (if present).
-
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.
-
writeToMark()
- Writes up to and including the end tag of the previously marked
element.
writer
protected Writer writer
- A writer to write output to.
elements
protected Stack elements
- Keeps track of incr elements.
marks
protected Stack marks
- Tracks incr marks.
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.
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
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
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.
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
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
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