XMLWriter
takes a DOM4J tree and formats it to a stream as XML. It can also take SAX events too so can be used by SAX clients as this object implements the {@link org.xml.sax.ContentHandler}and {@link LexicalHandler} interfaces. as well. This formatter performs typical documentformatting. The XML declaration and processing instructions are always on their own lines. An {@link OutputFormat}object can be used to define how whitespace is handled when printing and allows various configuration options, such as to allow suppression of the XML declaration, the encoding declaration or whether empty documents are collapsed.
There are write(...)
methods to print any of the standard DOM4J classes, including Document
and Element
, to either a Writer
or an OutputStream
. Warning: using your own Writer
may cause the writer's preferred character encoding to be ignored. If you use encodings other than UTF8, we recommend using the method that takes an OutputStream instead.
@author
James Strachan
@author Joseph Bowbeer
@version $Revision: 1.83 $