[jdom-interest] XPath support

Duffey, Kevin KDuffey at BUYMEDIA.com
Wed Aug 28 18:06:48 PDT 2002


Just be cautious of one thing when using DOM or JDOM, memory! Both are
memory hogs. I loaded a 13MB XML file via JDOM and it ate up over 80MB
of memory. May app was running out of memory until I changed the startup
of it. Even so, our clients will have machines with as little as 32MB of
ram, so for me DOM/JDOM was not an option. Sax2 is nice, but a little
ugly on the code, which is why JDOM was so appealing. Recently I have
switched to XMLPullParser technology, which is faster than SAX2, more
memory efficient (or about the same) as SAX2, but also easier on the
eyes in terms of coding. The downside, it only reads XML and ignores
things like Processing Instructions, and although it has a more flexible
architecture than DOM/SAX in terms of handling xml validation, it
currently does not provide any sort of xml validation capabilitiy. It is
easy to plug one in, but as of yet I don't think there are any that can
use DTD or XML Schema. You can however easily validate the file during
parsing.

JDOM would take about 8 seconds to read the 13MB document in, and
rightly so as it was creating a full suite of objects along the way so
that you can access all of the nodes in any order you want. With the
XMLPullParser it takes less than a second to parse the entire file, and
because of its design it is easy to "ignore" entire branches of parsing,
thus speeding things up greatly in larger files with repetitive nodes
you don't need to parse.

Where XMLPull is really handy is in handling Web Services parsing of
XML, and I also think it works well in "pre-coded" xml config files,
although if you want to update an XML config file it presently wont work
with XMLPullParser technology.

Go to http://www.xmlpull.org for more info on this technology. I believe
they are working on the standard still and also the ability to
create/write xml out using it.


-----Original Message-----
From: Hushagen, Michael E. [mailto:MEHushagen at fedins.com] 
Sent: Wednesday, August 28, 2002 1:24 PM
To: 'jdom-interest at jdom.org'
Subject: [jdom-interest] XPath support

This question may be more for Jason Hunter and/or Brett McLaughlin.
We are currently investigating whether to use DOM or JDOM in our
transactional XML-based web application.  Many of our functions involve
searching, removing, and replacing elements and their text values.
Naturally, using Xpath is much easier than coding a bunch of recursive
search methods. We briefly experimented with using DOM's built-in Xpath
support, and also experimented with JDOM using Jaxen as it's Xpath
support.
JDOM is much more intuitive to code in as a Java developer, but we're a
little worried about using a third-party Xpath solution.  Also, the
JDOM/Jaxen combo seems slower compared to DOM.  We have only run a few
small
tests so far though... 
Any thoughts on this?  Will JDOM have native Xpath support any time
soon?

Thanks,
 -Mike Hushagen
__________________________________________________________________
This information is intended only for the use of the addressee(s) and
may contain privileged, confidential or proprietary information.  If you
are not the intended recipient, or the employee or agent responsible for
delivering the message to the intended recipient, you are hereby
notified that any dissemination, distribution, displaying, copying, or
use of this information is strictly prohibited.  If you have received
this communication in error, please notify us immediately at
Administrator at fedins.com or by telephone at (800) 533-0472, and return
the information to the sender with all copies deleted and destroyed.
Thank you.

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@you
rhost.com



More information about the jdom-interest mailing list