This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Best XML Parsing Tool? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Best XML Parsing Tool?" Watch "Best XML Parsing Tool?" New topic
Author

Best XML Parsing Tool?

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Hi,
I would like to know that which open source(free)tool or APIs is best for XML parsing in terms of simplicity, time to write code, flexibility(If XML or schema changes) etc. I am confuse b/w Castor, JAXB, JDOM, Digaster.
Please help me out.
Thanks a lot.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12675
    
    5
In terms of simplicity, just use the packages built in to the standard Java library ever since Java 1.4 - this avoids getting tangled up in classpath issues, distribution of jar files to customers, etc.
Bill
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
sorry but what you want to say William?
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Originally posted by rathi ji:
sorry but what you want to say William?


If I understood right, I think William said "if simplicity is your measuring scale, use JDK 1.4 for parsing XML".
Thanks.

- m


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12675
    
    5
Exactly! Either Java 1.4 or 1.5 has a perfectly adaquate XML parsing library.
What is your XML parsing problem? XML is used for everything from simple configuration files (as in Tomcat) to truly monsterous gigbyte data files, so there is no general answer.
Bill
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
OK William, I got your point.
My requirement are:
1] I just need to unmarshal(read) XML file.
2] XML file is reasonably complex like have depth upto 5 level, some elements may have up to two attributes...
3] Time to write parser code should not take much time.
4] Performance is not really an issue because, I will parse it only once during whole life cycle of project.
5] Tool should be easy to learn like JDOM.

Now can you tell me, which one will be good for me?
Thanks.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12675
    
    5
The standard library should handle this easily and there are plenty of tutorials. I don't use JDOM or Digester because it is much easier for my clients to stick to absolutely standard Java installations.
Using the standard library, once you have a Document (org.w3c.dom.Document) in memory you can use the various methods in the Node and Element classes (org.w3c.dom package) to extract attributes and element content. Study the table in the Node JavaDocs that tells what the various types of XML Node have for values.
If I was starting fresh in this field and did not want to go into detail, I would look at Digester which seems to be designed for this sort of configuration file.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best XML Parsing Tool?
 
Similar Threads
Editors
parser
XML and SOAP Attachment
What API do I use for XML ???
parsing huge xml files