[jdom-interest] dump a document to a string
Ken Rune Helland
kenh at csc.no
Mon Dec 11 23:19:20 PST 2000
On Mon, 11 Dec 2000, Jason Hunter wrote:
> Read the Javadocs for XMLOutputter. Look for methods that return
> String.
>
> -jh-
>
> Neil Burnett wrote:
> >
> > Can I dump a Document to a String using XMLOutputter(" ",true) (or
> > anything else?).
> >
> > Neil
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
>
The XMLoutputter writes to a outputstream or writer object.
exsample:
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
org.jdom.output.XMLOutputter outputter = new org.jdom.output.XMLOutputter();
outputter.output(this.parsedDocument, baos);
Java has outputstream and writer objects that stores what writen to them
in byte arrays (java.io.ByteArrayOutputStream) , string(buffer)
(StringWriter) or Character arrays (CharArrayWriter).
You also have reader/inputstream classes if you need to
read any of these as a stream.
KenR
More information about the jdom-interest
mailing list