|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.empire.xml.XMLWriter
public class XMLWriter
This class prints out a XML-DOM-Tree to an output stream.
Field Summary | |
---|---|
protected boolean |
canonical
Canonical output. |
protected static org.slf4j.Logger |
log
|
protected PrintWriter |
out
Print writer. |
Constructor Summary | |
---|---|
XMLWriter(OutputStream outStream)
Constructor |
|
XMLWriter(OutputStream outStream,
String charsetEncoding)
Creates a XML Writer object. |
|
XMLWriter(Writer writer,
String charsetEncoding)
Creates a XML Writer object. |
Method Summary | |
---|---|
static void |
debug(Document doc)
Prints out the DOM-Tree on System.out for debugging purposes. |
static void |
debugToFile(Document doc,
String filename)
Prints out the DOM-Tree to a file for debugging purposes. |
protected String |
normalize(String s)
Converts a string to valid XML-Syntax replacing XML entities. |
static String |
normalize(String s,
boolean canonical)
|
void |
print(Document doc)
Prints the specified document. |
void |
print(Document doc,
String styleSheet)
Prints the specified document. |
int |
print(Node node,
int level)
Prints the specified node recursively |
static void |
saveAsFile(Document doc,
String filename)
Prints out the DOM-Tree. |
static void |
setXmlWriterDebugPath(String path)
|
protected Attr[] |
sortAttributes(NamedNodeMap attrs)
Sorts attributes by name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.slf4j.Logger log
protected PrintWriter out
protected boolean canonical
Constructor Detail |
---|
public XMLWriter(Writer writer, String charsetEncoding)
writer
- a writer to the output streamcharsetEncoding
- encoding type (i.e. utf-8)public XMLWriter(OutputStream outStream, String charsetEncoding) throws UnsupportedEncodingException
outStream
- the output streamcharsetEncoding
- The name of a supported
charset
UnsupportedEncodingException
- If the named encoding is not supportedpublic XMLWriter(OutputStream outStream)
outStream
- the output streamMethod Detail |
---|
public static void debug(Document doc)
doc
- The XML-Document to printpublic static void debugToFile(Document doc, String filename)
doc
- The XML-Document to printfilename
- The name of the file to write the XML-Document topublic static void saveAsFile(Document doc, String filename)
doc
- The XML-Document to printfilename
- The name of the file to write the XML-Document topublic static void setXmlWriterDebugPath(String path)
public int print(Node node, int level)
node
- the current node to printlevel
- the nesting level used for indenting the output
public void print(Document doc)
doc
- the XML-DOM-Document to printpublic void print(Document doc, String styleSheet)
doc
- the XML-DOM-Document to printstyleSheet
- the XML-DOM-Document to printprotected Attr[] sortAttributes(NamedNodeMap attrs)
attrs
- the unsorted list of attributes
protected String normalize(String s)
s
- the string to normalizepublic static String normalize(String s, boolean canonical)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |