Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOM or SAX

Status
Not open for further replies.

noodles1

Programmer
Oct 31, 2001
58
I have a requirement to read in the contents of an XML document and decode the contents to assign to various members of a C or C++ structure. Typically around 10-20 structure members.

Which model, DOM or SAX, is the preferred approach for this type of requirement?
 
For those wondering what DOM and SAX are:
DOM = document object model
SAX = Simple API for XML.

If the structure is small, DOM would be the better bet: just read it all in and then you can do what you want.

With SAX you get events on every element. It is a bit slower and a pain to debug because it goes into your code, then the SAX code and then back into your code. If the file is big then you'd probably have to go for SAX.

Something like Xerxes will do both.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top