Solved

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

Posted on 2007-11-15
5
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

631 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