Solved

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

Posted on 2007-11-15
5
256 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countX 22 69
Python Assistance 7 31
base64 decode encode 12 96
what is the difference between "sudo su" and "su - root" 6 68
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)
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

743 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

8 Experts available now in Live!

Get 1:1 Help Now