If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > JAVA > xml-java

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-25-08, 03:43
dimis2500 dimis2500 is offline
Registered User
 
Join Date: Jan 2005
Posts: 362
xml-java

I Have a xml file and I want to read it and import to mysql the values of xml file.
It is good to use a xml parser (and what may be better) or just to uses the libraries of jdk?
The records of xml file is about 55000 as I know.
Dimis
Reply With Quote
  #2 (permalink)  
Old 07-05-08, 20:12
sco08y sco08y is offline
Registered User
 
Join Date: Oct 2002
Location: Baghdad, Iraq
Posts: 697
You'd want to use an event-based parser that conforms to the SAX protocol. As I recall it is included at least with JDK 1.5.

DOM parsers are easier to use, but they load the whole document into memory which you don't really need to do. All you care about is when the appropriate tags are encountered.
Reply With Quote
  #3 (permalink)  
Old 07-07-08, 14:09
gutierrez.ge gutierrez.ge is offline
Registered User
 
Join Date: Jul 2008
Posts: 2
you can use xpath expression with jaxen library (i thing there is another one from apache called xpath as well) and then you can query the tags instead of implementing your own reading, i think it would be faster.

Hope it helps
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On