|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.crimson.tree.XmlWriteContext
This captures context used when writing XML text, such as state used to "pretty print" output or to identify entities which are defined. Pretty printing is useful when displaying structure in XML documents that need to be read or edited by people (rather than only by machines).
XmlWritable
,
XmlDocument.createWriteContext(java.io.Writer)
Field Summary | |
private int |
indentLevel
|
private boolean |
prettyOutput
|
private Writer |
writer
|
Constructor Summary | |
XmlWriteContext(Writer out)
Constructs a write context that doesn't pretty-print output. |
|
XmlWriteContext(Writer out,
int level)
Constructs a write context that supports pretty-printing output starting at the specified number of spaces. |
Method Summary | |
int |
getIndentLevel()
Returns the current indent level, in terms of spaces, for use in pretty printing XML text. |
Writer |
getWriter()
Returns the writer to which output should be written. |
boolean |
isEntityDeclared(String name)
Returns true if the specified entity was already declared in this output context, so that entity references may be written rather than their expanded values. |
boolean |
isPrettyOutput()
Returns true if writes using the context should "pretty print", displaying structure through indentation as appropriate. |
void |
printIndent()
If pretty printing is enabled, this writes a newline followed by indentLevel spaces. |
void |
setIndentLevel(int level)
Assigns the current indent level, in terms of spaces, for use in pretty printing XML text. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private Writer writer
private int indentLevel
private boolean prettyOutput
Constructor Detail |
public XmlWriteContext(Writer out)
public XmlWriteContext(Writer out, int level)
Method Detail |
public Writer getWriter()
public boolean isEntityDeclared(String name)
public int getIndentLevel()
public void setIndentLevel(int level)
public void printIndent() throws IOException
Note that this method should not be used except in cases where the additional whitespace is guaranteed to be semantically meaningless. This is the default, and is controlled through the xml:space attribute, inherited from parent elements. When this attribute value is preserve, this method should not be used. Otherwise, text normalization is expected to remove excess whitespace such as that added by this call.
IOException
public boolean isPrettyOutput()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |