views:

96

answers:

4

I have to parse the XML file and build objects representation based on that, now once I get all these data I create entries in various database for these data objects. I have to do second pass over that for value as in the first pass all I could do is build the assets in various databases. and in second pass I get the values for all the data and put it in the database.

I have a feeling that this can be done in a single pass but I just want to see what are your opinions. As I am just a student who started with professional work, experienced ppl please help.

Can someone who have ideas or done similar work, please provide some light on the topic so that I can think over the possibility of the work and get the prototype going based on your suggestion.

Thanks a lot for your precious time, I honestly appreciate it.

+1  A: 

You might be interested in learning several techniques of building XML parsers like DOM or SAX. As it is said in SAX description the only thing which requires second pass could be the XML validation but not the creating the tree.

AlexKR
it's complicated and I have to dig more stuff out
Gollum
A: 

Beside DOM and SAX parsing, you can use XQuery for querying data from XML files.It is fast, robust and efficient.

here is a link

You can use Qt Xml module for DOM ,SAX and XQuery, btw it is open source.

Another option is xml - C++ data binding, Here is the link.You can create C++ codes from definition directly.It is an elegant solution.

EDIT:

the latter one is at compile time.

Qubeuc
A: 

You can also use Apache Licensed http://xmlbeansxx.touk.pl/. It works under Windows and Linux.

Rafal Rusin
A: 

you could take a look at the somewhat simpler 'pull' api called stax instead of using sax (event based).

Karussell