[jdom-interest] Element and Document serialized forms

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed Jul 12 12:19:14 PDT 2000

I've implemented the getSerializedForm() methods in Element and
Document. The code is at


Neither the code nor the output is particularly elegant. I know we plan
to move this functionality into XMLOutputter or some similar class soon,
so I didn't want to go overboard with it; and indeed I'm not sure we
should check this into the main tree since it would mostly encourage
using an API that will change soon. However, I did want to finish it up
as a way to get started on the more permanent API.

I think what I'm going to do now is spend a little time thinking about
what the API for node-by-node serialization should look like. I'm
leaning toward making this a different class than XMLOutputter, and to
implement it as a series of static methods that only return strings.
Some methods might use an XMLOutputter internally though. Or is that
backwards?  Certainly there's a lot of code that needs to be shared
between XMLSerializer and XMLOutputter, if indeed they aren't the same
thing. However, I would very much like to avoid the encoding hassles
that plague XMLOutputter in XMLSerializer. 

| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
|               Java I/O (O'Reilly & Associates, 1999)               |
|            http://metalab.unc.edu/javafaq/books/javaio/            |
|   http://www.amazon.com/exec/obidos/ISBN=1565924851/cafeaulaitA/   |
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ | 
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |

More information about the jdom-interest mailing list