>> If that's the perceived complaint, wouldn't it be better to 
>> connect the
>> model data to the view using a sax pipeline rather than 
>> passing around a
>> dom or dom-like object, or even worse, a String?
>
>And the sax 'pipeline' (I assume you mean an InputStream?) is connected
>to....what?  If your model data (XML format) is in memory (which it has to
>be, unless you're yanking it straight from a DB BLOB), then what's the
>difference?  The amount of memory consumed by a DOM representation
>compared to a straight-up byte array of XML data is neglible, IMHO.  If
>there's a performance difference between the two as far as XSLT is
>concerned, I'm not aware of it.

I don't mean an InputStream, I mean a sax pipeline. sax is an event-based
api for transferring xml data. In the typical mode, a sax generator,
typically a parser, is given a ContentHandler object on which it will call
methods (startElement(), endElement() characters(), etc.) as needed. A sax
pipeline consists of a generator (which produces the events which start the
pipeline), a serializer (which consumes the events which end the pipeline),
and possibly one or more filters (e.g. xslt stylesheet transformers) which
both consume and produce sax events.

The amount of memory consumed by a DOM representation of an xml file is
actually quite significant. Typical implementations used to consume about
3x as much memory for the DOM object as the xml character data itself! The
various lightweight dom-like object models which have come about (e.g.
dom4j, jdom) are much more efficient in that regard, but the object-passing
model is still inferior to the event-pipeline model for a couple of
reasons:

1. In the object-passing model, each stage of the processing pipeline must
complete before the next stage can begin. In the event-pipeline model, it
is possible for the serializer to begin sending data to the destination
(e.g. browser) before the parser has even finished parsing the source
document (the later versions of Xalan can do this, dunno about saxon, et.
al.)

2. In the object-passing model, the entire xml object must fit in memory at
the same time. The event-pipeline model, this isn't required.

- donald


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to