[jdom-interest] Element and Document serialized forms
jhunter at collab.net
Sat Jul 15 13:17:56 PDT 2000
> However, Jason pointed out that we couldn't use streams in servlets,
> only writers.
That's not exactly right. I said there are some cases (not the general
case) with servlets where you'd only be allowed to use a Writer.
Specifically when you were the target of an include.
Received: from mimer.webgiro.com ([18.104.22.168])
by dorothy.denveronline.net (8.9.3/8.9.3) with ESMTP id MAA19120
for <jdom-interest at jdom.org>; Sat, 15 Jul 2000 12:30:24 -0600 (MDT)
Received: by mimer.webgiro.com (Postfix, from userid 66)
id 1DCE12DC0E; Sat, 15 Jul 2000 20:35:33 +0200 (CEST)
Received: by mx.webgiro.com (Postfix, from userid 1001)
id 4E5AB7817; Sat, 15 Jul 2000 20:29:02 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
by mx.webgiro.com (Postfix) with ESMTP
id 48D5910E17; Sat, 15 Jul 2000 20:29:02 +0200 (CEST)
Date: Sat, 15 Jul 2000 20:29:00 +0200 (CEST)
From: Andrzej Bialecki <abial at webgiro.com>
To: Elliotte Rusty Harold <elharo at metalab.unc.edu>
Cc: alex at jguru.com, jdom-interest at jdom.org
Subject: Re: [jdom-interest] AleXMLOutputter
Message-ID: <Pine.BSF.4.20.0007152010150.78199-100000 at mx.webgiro.com>
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: jdom-interest-admin at jdom.org
Errors-To: jdom-interest-admin at jdom.org
X-BeenThere: jdom-interest at jdom.org
List-Id: JDOM Mailing List for General Issues and Updates <jdom-interest.jdom.org>
On Sat, 15 Jul 2000, Elliotte Rusty Harold wrote:
> At 7:45 AM -0700 7/14/00, Alex Chaffee wrote:
> >I rewrote XMLOutputter to have public methods for serializing nodes
> >other than document. Patch is at the end of this email. I don't want
> >to step on Rusty's toes here, but the fact is, my code works, more or
> >less, so an argument could be made for checking it into the main code
> >base pending further developments from Rusty's camp.
> The issue I see with these is that the API is far more complex than
> it needs to be. This is not sufficient to replace
> getSerializedForm(). Given an Element e (or a Comment c, or a
> Document d) calling getSerializedForm() is easy. Just
> String s = e.getSerializedForm();
I've been lurking here for some time, but not too long, so I'm not sure if
this topic was discussed before...
Anyway: why Elements, PIs, DocType etc.. don't extend the same basic
class? Or implement common interface that extends Serializable? IMHO it's
easier for developer to just throw whatever he has on the plate to the
XMLOutputter without having to know which particular method to use for
this particular node type. I think this would simplify API.
The reason for this question is that in my application I have to serialize
parts of documents, starting from specific node (not from the root), and
then store split parts (adding some decoration like docType) into
different locations. Tt would be nice to have possibility to supply any
document fragment, not only the root element, to XMLOutputter and receive
it in serialized form.
> The big issue is how to configure the formatting performed by
> XMLOutputter.getSerializedForm(). We could:
I don't mind supplying additional object specifying dozens
of serialization parameters. This would buy me extra flexibility of
having different serialization parameters for different document
fragments (e.g. pretty formatting for parts likely to be read by
humans, condensed spaghetti for parts to be stored in the DB).
I'd vote for OutputFormat class, if it matters :-)
// <abial at webgiro.com> WebGiro AB, Sweden (http://www.webgiro.com)
// ------ FreeBSD: The Power to Serve. http://www.freebsd.org --------
// --- Small & Embedded FreeBSD: http://www.freebsd.org/~picobsd/ ----
More information about the jdom-interest