I've used it on a few projects-- XSLT Dom to Dom transformations are a little buggy 
yet. Dom4j's web site does offer some links to benchmarks:
 
http://www.dom4j.org/benchmarks/xpath/index.html  Dom4j vs. Xalan with XPath Queries
http://www-106.ibm.com/developerworks/library/x-injava2/  Dom4j vs. Everyone
 
Dom4j also has support for PullParsing or XPP.  This, when paired with the ability to 
prune on read allows very large documents to be executed upon in short order. One 
other issue is that Dom4j does not align with the w3c standard API.  There are 
partially finished classes for integration, but it needs some work yet as of the last 
release I looked at (<1mo).
 
If we want to discuss XML->Bean->XML, then yes, Betwixt would be ideal.  I prefer 
Castor (www.castor.org) because it provides a little more customizability for how the 
documents are (un?)marshalled.
 
-Jacob

        -----Original Message----- 
        From: Jacob Kjome [mailto:[EMAIL PROTECTED]] 
        Sent: Sun 1/5/2003 2:11 PM 
        To: Tomcat Users List 
        Cc: 
        Subject: RE: Loading XML Files - Best Pracitices
        
        


        Hi Jacob,
        
        Did you actually test the performance of Dom4j?  I'm just curious.  I have
        heard very good things about Dom4j.
        
        Jake
        
        At 08:08 PM 1/4/2003 -0600, you wrote:
        >I recommend Dom4j, it offers the best overall performance out of the XML
        >libs and it works really well for large files with the ability to prune on
        >read.
        >
        >www.dom4j.org
        >
        >
        >         -----Original Message-----
        >         From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
        >         Sent: Sat 1/4/2003 1:58 PM
        >         To: Tomcat Users List
        >         Cc:
        >         Subject: Re: Loading XML Files - Best Pracitices
        >
        >
        >
        >
        >         No, I don't really have any reservations about JDOM...except for
        > the fact
        >         that there has been little to zero development on it of
        > late.  Check out
        >         the amount of time that has passed since the last beta release (9
        > - 10
        >         months!).  At this rate, they'll release a 1.0 version in a
        > couple more
        >         years while Xerces development steams on ahead.  JDOM may be
        > elegant, but I
        >         wish the main developers would put their nose to the grindstone
        > and get, at
        >         least, another beta release out in short order!
        >
        >         To tell you the truth, I would just use a SAX parser.  That will
        > be faster
        >         than any of the other methods including JDOM.
        >
        >         Jake
        >
        >         At 12:01 PM 1/4/2003 -0600, you wrote:
        >         >Howdy,
        >         >
        >         >Thanks for all the good suggestions. I'm going with JDOM, just
        > because
        >         >it's pretty darn elegant and simple. It also appears that it will be
        >         >(if not already) an XML standard for Java.  So all signs
        > indicate that
        >         >I'm not marrying myself to an obscure API.
        >         >
        >         >Do any of you have reservations about JDOM?
        >         >
        >         >Thanks,
        >         >-FB
        >         >
        >         >On Saturday, January 4, 2003, at 08:02  AM, Jacob Kjome wrote:
        >         >
        >         >>
        >         >>Well,
        >         >>
        >         >>There are a number of parsers available.  You can use DOM, JDOM,
        >         >>DOM4J, SAX, or, actually, you might want to try out XPath using
        > Jaxen.
        >         >>
        >         >>Here is an example of reading in a document using DOM....and no
        >         >>specific external package so you don't marry yourself to a
        > particular
        >         >>implementation...
        >         >>
        >         >>DocumentBuilderFactory dbfactory =
        >         >>DocumentBuilderFactory.newInstance();
        >         >>dbfactory.setNamespaceAware(true);
        >         >>Document doc = null;
        >         >>try {
        >         >>     DocumentBuilder dbuilder = dbfactory.newDocumentBuilder();
        >         >>     InputStream =
        > context.getResourceAsStream("/WEB-INF/mydoc.xml");
        >         >>     doc = dbuilder.parse(is);
        >         >>}
        >         >>catch (ParserConfigurationException pce) {}
        >         >>catch (SAXException se) {}
        >         >>catch (IOException ioe) {}
        >         >>
        >         >>
        >         >>You can then grab a NodeList of some part of the document and
        > iterate
        >         >>through that or you can then use Jaxen to get to specific data with
        >         >>XPath queries....
        >         >>
        >         >>
        >         >>try {
        >         >>     XPath xpath = new
        >         >>DOMXPath("//MyElement[@myAttribute='someSpecificValue']/
        > AnotherElement");
        >         >>     Node node = (Node)xpath.selectSingleNode(domainDoc);
        >         >>     //now do something with the node
        >         >>}
        >         >>catch (XPathSyntaxException xse) {}
        >         >>catch (JaxenException je) {}
        >         >>
        >         >>
        >         >>If you know, in advance, all the elements you will need to
        > read, then
        >         >>you might want to write a SAX parser for your document.  It will be
        >         >>the fastest method....or you could use XML data binding using
        > Zeus or
        >         >>JAXB which will allow you to read in a whole document and
        > access all
        >         >>the data using standard Java Bean getters and set the values using
        >         >>standard Java bean setters.  In this case, you don't even need to
        >         >>worry about XML since the fact that it is XML is totally hidden
        > from
        >         >>you.  You can then marshal your updated object (assuming you
        > modified
        >         >>it) back to an XML document.
        >         >>
        >         >>There are lots of ways to do this.  Which way you choose depends on
        >         >>your needs and what API's you feel most comfortable with.
        >         >>
        >         >>Jake
        >         >>
        >         >>
        >         >>At 07:29 PM 1/3/2003 -0600, you wrote:
        >         >>>I have a servlet and I want it to read it's data from an XML file.
        >         >>>There's more than one way of doing this task and I'm fishing
        > for best
        >         >>>practices.
        >         >>>Can anyone provide me with some links to example code? I'm
        > sure this
        >         >>>has been beaten to death and I don't want to reinvent the wheel.
        >         >>>
        >         >>>Thanks!
        >         >>>
        >         >>>
        >         >>>--
        >         >>>To unsubscribe, e-mail:
        >         >>><mailto:[EMAIL PROTECTED]>
        >         >>>For additional commands, e-mail:
        >         >>><mailto:[EMAIL PROTECTED]>
        >         >
        >         >
        >         >--
        >         >To unsubscribe,
        > e-mail:   <mailto:[EMAIL PROTECTED]>
        >         >For additional commands, e-mail:
        > <mailto:[EMAIL PROTECTED]>
        >
        >
        >
        >--
        >To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
        >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
        

<<winmail.dat>>

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

Reply via email to