Solved

Best XML parser for Java - just want to get specific fields

Posted on 2007-11-15
5
257 Views
Last Modified: 2013-12-29
I have a decent sized XML input file, a few thousand lines, that contains and invoice with between 1 and n number of item loops, as well as some overall order info.  I need to parse that data in a java servlet and insert the data in to a sql database.  That is an over-simplification of the process, in reality some data may be missing and I need to get it elsewhere (another DB), or data may be in different places depending on the vendor (invoice may not have item loops and instead have total information and some items in comments).

My question is what is the best XML parser to use in Java to accomplish this (considering I'm a beginner).  I think I need one that will load the whole document because I may need to randomly access elements all over the document.  Is this something that should involve xquery or xpath, and maybe saxon?
0
Comment
Question by:arrkerr1024
5 Comments
 
LVL 17

Expert Comment

by:contactkarthi
ID: 20298163
I will advice you to use xpath

http://www.cafeconleche.org/books/xmljava/chapters/ch16.html

use the below tool if you are going to use xpath to get help in generating the query
http://weblogs.asp.net/nleghari/articles/27951.aspx

have a look at this tutorial for sax vs dom

http://developerlife.com/tutorials/?p=28

also have a look at
http://www.xml.com/pub/rg/SAX_vs_DOM

0
 
LVL 6

Expert Comment

by:VBGuru
ID: 20468117
if you are thinking of making your coding life easier? then you can think of using JAXB
0
 
LVL 14

Accepted Solution

by:
arrkerr1024 earned 0 total points
ID: 20707697
the best solution turned out to be to strip down the original xml using xsl and the saxon parser, then to use grab it with java.
0
 
LVL 1

Expert Comment

by:Vee_Mod
ID: 20747291
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
topping2 challenge 13 80
advertisement module in core php 4 144
Where to store the queries for modification of table 4 54
Java - Why doesn't this JFrame work 3 41
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now