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?
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.