|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deckfour.spex.SXNode org.deckfour.spex.SXDocument
public class SXDocument
This class represents an XML document. It is a convenient wrapper for writing XML documents sequentially, while preserving a quasi-object-oriented interface.
SXTag
Field Summary | |
---|---|
protected boolean |
isOpen
Whether this document is still open. |
protected SXNode |
lastChildNode
Last opened child node of this document. |
protected String |
tabString
Tabulator string. |
Fields inherited from class org.deckfour.spex.SXNode |
---|
tabLevel, writer |
Constructor Summary | |
---|---|
SXDocument(File aFile)
Creates a new document with standard UTF-8 encoding. |
|
SXDocument(OutputStream aStream)
Creates a new document with standard UTF-8 encoding. |
|
SXDocument(OutputStream aStream,
Charset aCharset)
Creates a new document. |
|
SXDocument(OutputStream aStream,
String aCharsetName)
Creates a new document. |
|
SXDocument(Writer writer,
Charset charset)
Creates a new document. |
Method Summary | |
---|---|
void |
addComment(String comment)
Adds a comment to this document. |
SXTag |
addNode(String tagName)
Adds a regular, named node to this document (usually one single root node) WARNING: This will close the last added tag, if applicable! |
void |
close()
Closes this document. |
String |
getTabString()
Returns this document's tabulator encoding. |
protected void |
prepareToAddChildNode()
Internal abstraction method; prepares the document for inserting a new child tag of any type. |
void |
setTabString(String aTabString)
Sets this document's tabulator encoding. |
Methods inherited from class org.deckfour.spex.SXNode |
---|
getTabLevel, indentLine |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String tabString
protected SXNode lastChildNode
protected boolean isOpen
Constructor Detail |
---|
public SXDocument(Writer writer, Charset charset) throws IOException
aWriter
- writer instance to write document toaCharset
- charset used for encoding in the provided Writer
IOException
public SXDocument(OutputStream aStream, Charset aCharset) throws IOException
aStream
- output stream to write document toaCharset
- charset to be used for encoding
IOException
public SXDocument(OutputStream aStream, String aCharsetName) throws IOException
aStream
- output stream to write document toaCharsetName
- standard name of the charset to be used for encoding
IOException
public SXDocument(OutputStream aStream) throws IOException
aStream
- output stream to write document to
IOException
public SXDocument(File aFile) throws IOException
aFile
- file to write the document to
IOException
Method Detail |
---|
protected void prepareToAddChildNode() throws IOException
IOException
public SXTag addNode(String tagName) throws IOException
tagName
- The name of the tag to add (contents between brackets)
IOException
public void addComment(String comment) throws IOException
comment
- The comment line to be added.
IOException
public void close() throws IOException
close
in class SXNode
IOException
public void setTabString(String aTabString)
aTabString
- Tabulator string to be used.public String getTabString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |