I don't know which API/tool(Xerces2, dom4j, XOM, JAXP, etc.) to use for reading/writing XML files and validating XML schema?
Can I use Xerces2 since it's quite faster now? Or use the dom4j which enhanced the well-known JDOM? Or just use Java 1.4 JDK built-in classes? (I'm not planning to use the JAXB since it needs compilation and installation of Web Services Developer Pack on server)
Is there some reason you are not considering the latest version of JAXP in Java 1.5? Unless you have a HUGE load of XML to parse I would not worry about speed at all. The advantage of using the standard library for me is that all customers have to have is Java 1.5, no fiddling with classpaths and obscure jar files. For better quality advice, tell us more about what you need to do! Bill
posted 14 years ago
It's because our team uses Websphere Application Server 6.0 and it is shared by many other teams. We may not upgrade it with JDK 5.0 while they're using 1.4. (But I really want 5.0 and 6.0 is coming!)
My use of XML API are for: a. generating hierarchical XML files from java object e.g. String, ArrayList. b. parsing XML files from 3rd parties with XML Schema validation and then saved the data to database.
I'm looking for a easy and speedy API to use. Also I may want to figure out which is rubust, well-known standard of use it. What I researched on the API so far are:
Xerces2 is well-known, dom4j seems easier, JAXP is the standard. But I don't know what are the difference between them.
Am I right?
Regards, Tang I've just passed SCJP 1.4 and I'm a newbie!
Just use JAXP for now. It's already included in Java 1.4. But keep on learning so that you can make your own decisions. The answer to "Which one should I use?" is "The one that's most suitable for you." At present your needs are simple, so spend your time learning how to use XML with a parser that you already have rather than falling into "analysis paralysis".
posted 14 years ago
But, for parsing and generating XML files, JDK 1.4 contains only javax.xml.parsers.*, org.w3c.dom.*, org.xml.sax.*
Does it have too few functions to use?
(JDK 1.5 contains Xerces2 but our development team cannot use it currently!)