|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.javasoft.xml.config.XmlPrint
public class XmlPrint
The XmlPrint class contains methods to print xml nicely, that is whith desired indenting.
The current implementation does not support textual content and does not print comments. A supported xml file should thus contain textual information in the attributes of the elements, and elements themselves should only contain attributes and nested elements.
| Field Summary | |
|---|---|
protected String |
mIndention
|
| Constructor Summary | |
|---|---|
XmlPrint()
Constructor for default indention, that is a single tab per indention level |
|
XmlPrint(String indention)
Constructor for given indention |
|
| Method Summary | |
|---|---|
protected String |
getIndention()
Returns the per-level indention. |
void |
print(Document doc)
Print the given document to the standard output |
void |
print(Document doc,
OutputStream out)
Print the given document to the given output stream |
void |
print(Document doc,
PrintWriter writer)
Print the given document using the given print writer |
void |
print(Document doc,
Writer writer)
Print the given document using the given writer |
void |
print(Element elem)
Print the given element to the standard output |
void |
print(Element elem,
OutputStream out)
Print the given element to the given output stream |
void |
print(Element elem,
PrintWriter writer)
Print the given element using the given print writer |
void |
print(Element elem,
String indention,
PrintWriter writer)
Print the given element using the given print writer and initial indention |
void |
print(Element elem,
Writer writer)
Print the given element using the given writer |
protected void |
printDeclaration(Document doc,
PrintWriter writer)
Prints the xml declaration (the first line of an xml file) |
String |
toString(Document doc)
Returns the given document as a string |
String |
toString(Element elem)
Returns the given element as a string |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final String mIndention
| Constructor Detail |
|---|
public XmlPrint()
public XmlPrint(String indention)
indention - the desired indention per level| Method Detail |
|---|
public void print(Document doc)
doc - the xml document
public void print(Document doc,
OutputStream out)
doc - the xml documentout - the output stream to write to
public void print(Document doc,
Writer writer)
doc - the xml documentwriter - the writer to use for the output
public void print(Document doc,
PrintWriter writer)
doc - the xml documentwriter - the print writer to use for the outputpublic void print(Element elem)
elem - the xml element
public void print(Element elem,
OutputStream out)
elem - the xml elementout - the output stream to write to
public void print(Element elem,
Writer writer)
elem - the xml elementwriter - the writer to use for the output
public void print(Element elem,
PrintWriter writer)
elem - the xml elementwriter - the print writer to use for the output
public void print(Element elem,
String indention,
PrintWriter writer)
elem - the xml elementindention - the initial indentionwriter - the print writer to use for the outputpublic String toString(Document doc)
doc - the xml documentpublic String toString(Element elem)
elem - the xml element
protected void printDeclaration(Document doc,
PrintWriter writer)
doc - the xml documentwriter - the writer to use for the outputprotected String getIndention()
XmlPrint instance was instantiated.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||