Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML Processing

 
Matt Corban
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Pat. That helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic