[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Question] How to do incremental parsing?
- From: David Brownell <firstname.lastname@example.org>
- To: "Xu, Mousheng (SEA)" <Mousheng.Xu@sea.celltechgroup.com>
- Date: Tue, 03 Jul 2001 19:57:28 -0700
> A problem of all the current XML parsers is that they at least read the
> whole XML document into the input stream, which can consume a lot of memory
> when the XML is big (e.g. 1 GB).
Use SAX, not DOM, whenever you're dealing with big documents.
All current SAX parsers don't do that; you seem to assume DOM.
Any reasonable SAX parser will have an almost constant space utilization
during parsing, consisting of:
- Any DTD related data structures necessary.
For non-validating parsers, that can be limited to
what's needed to default and normalize attributes,
and record entities.
- Stack space for the parser's control flow, entities
(if needed) and namespace contexts (if needed)
- I/O buffers.
If your document is a straight XML 1.0 document with
no DTD or namespaces, the only variable is the control
stack. That's usually not going to be very big, though
it'll normally grow linearly with element nesting depth.