Click to See Complete Forum and Search --> : XML & DOM programming


DavidBearh
04-12-2004, 11:33 AM
Hi,

I'm a programmer on a team. We're all new to XML and using RH linux. I started looking and found libXml2 and Gnome2 as potential things to use.

My question is this, what does a DOM buy me? Can't I get away with just using the libXml2?

Our uses for xml are internal to our program for the most part. We just want to do the following:

take a bunch of data and write in an xml format.

Then at a later point in time, read in xml files and perhaps import them to database tables.

Since libXml2 is capable of traversing nodes, does using a DOM on top of the libxml2 buy me anything of value?

Thanks!

David Bearh

Khalid Ali
04-12-2004, 08:55 PM
I have not used libXML2,however I can most certainly tell you about useages of DOM parsing.

DOM is extremely good when you have to keep something in memory and then keep on manipulating that XML data for some time for later on to write to a file or put it in DB.

If thats what you want to do then DOM can help allot, a very important thing to keep in mind is that since DOM keeps all data in memory, its slower...

redijedi
04-13-2004, 04:33 PM
Originally posted by Khalid Ali
...since DOM keeps all data in memory, its slower...

Not necessarily. The fact of the matter is that it is much faster to perform operation on memory resident data rather than making IO calls. The difference is huge! What DavidBearh may have meant by “slower” is that it’s going to take up some more of your RAM.

Khalid Ali
04-13-2004, 11:53 PM
Originally posted by Khalid Ali
Ithat since DOM keeps all data in memory, its slower...

Yes I meant that since it keeps whole file in memory there fore its comparatively slower thne other method(SAX)

DavidBearh
04-14-2004, 07:22 AM
Thanks for the information and replies.

Memory is an issue for what we are doing.

We're probably going to skip the DOM and just try to have the lightest layer of XML we can.

We have RAM, but we want to let other things use most of the RAM and let the XML portion only have a tiny piece.

David Bearh