[H-GEN] Edit massive XML files
Paul Gearon
gearon at ieee.org
Mon Oct 3 19:18:20 EDT 2011
On Mon, Oct 3, 2011 at 12:01 PM, Benjamin Fowler
<ben.fowler.bjf at gmail.com> wrote:
> What are your primary technical objections to using DOM? Memory consumption? Too low level?
It's not a reason to say "never use it", but it's an annoyingly
complex API. SAX and StAX are refreshingly simple by comparison.
The real reason though is memory consumption. Almost every occasion I
have for using XML is in a context where the data can be arbitrarily
large. Using the DOM is a great way to fail in production while also
passing every unit test.
> Its been a while since I've needed to diddle XML in code (I usually use XSLT, or a binding library, eg XMLBeans or JAXB), but I think it's okay for small documents where XSLT can't be used for some reason.
Almost every time I need to work with a small XML file it's because
it's bound through some kind of library, so for those contexts I don't
need to use the DOM either.
The only time I've used the DOM in recent years was in an AJAX
context, and that was only because (new XMLHttpRequest()).responseXML
contains a full DOM. The API was just as annoying as I remembered, and
of course I hit a memory limit soon after. :-)
Regards,
Paul
More information about the General
mailing list