This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes XML Processing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "XML Processing" Watch "XML Processing" New topic
Author

XML Processing

Matt Corban
Greenhorn

Joined: Apr 05, 2012
Posts: 2
I am currently working on a project where I need to process different xml files. Each element in the xml file has its own column name. I need to either store the entire xml in the database or process each element in the xml file and store it as a database object. If I store it as an object, I will need to process certain elements as dates and manipulate strings in order to store them in the database. If I store the xml directly to the database, I will need to later translate each element to a column name when I display it as html. So far, I am able to store the xml as a database object. The problem is each xml file has similar or different columns and I am having to create additional methods in order to store it as a database object. I am trying to avoid creating additional methods in order to process the columns. Any ideas on better ways to do this?
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4646
    
    5

You really have no choice, at some point you have to parse the XML to get access to the fields that contain the dates, strings, etc.

There are lots of XML parsing libraries, I recommend you find one you like and use it.

If you know that the XML is simple, and will never change, and will never get complex, you can try to write your own parser, but since there are well documented, tested, free libraries that you can use, its rarely worthwhile to write your own.
Matt Corban
Greenhorn

Joined: Apr 05, 2012
Posts: 2
Thanks Pat. That helps.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML Processing
 
Similar Threads
ui beginner feedback for JTable handling kindly wanted
Element with same name
Quickest way to create objects from XML....
How do we store objects in database table?
whats the best way ?