[
Lists Home |
Date Index |
Thread Index
]
> * XML documents are rarely smaller than memory
You presumably meant to say that they are rarely larger than memory?
>
> These two things conspire to make it that, for the lion's
> share of documents, by the time the SAX stream is finished,
> all the SAX events will be still in memory, though perhaps
> unreachable. If they are in memory, why not make them available?
>
SAX events are not objects. They are method calls containing objects as
their parameters. In many cases the underlying objects will be reused by
the parser, for example the same AttributeCollection object will be
reused for each startElement event, and the byte array that is passed to
the characters() method will be reused for each bufferfull of data that
is read from disc.
It's quite true, of course, that if you have enough memory to hold a DOM
representation of your document, then using SAX merely in order to save
memory is fairly pointless. But that doesn't seem a very profound
observation.
Michael Kay
|