[Newbies] xml file query and object mapping

Ron Teitelbaum Ron at USMedRec.com
Fri Jun 30 16:24:32 UTC 2006


The basic difference between SAX and DOM is that SAX is like a stream that
as it is read provides information to you to build the objects you need,
while DOM is more like a tree or object model that can be traversed like
regular objects.  They both have their advantages.  The big advantage for
SAX is in parsing large files.  Since it acts like a stream you can build
objects on the fly and not have to parse the entire file before getting a
single object.  DOM is much easier to use since it builds a tree for you
that can be traversed.  

For DOM to create an object you need to build your own object form the data
that each node of the tree provides to you.  The tree is a collection of
collections with each item an XMLElement that can respond with queries like
elementAt: #... you can iterate over the collection creating objects as you

For Sax you wait for a tag that indicates starting a new object then you
create the object and for each element that comes after you add data to your
object until you hit the end object tag.

If you are going to XML then you should learn both (which it seems you are
doing).  Good luck with it and feel free to let us know how you are doing
with it.  If you need more help let us know.

Ron Teitelbaum
President / Principal Software Engineer
US Medical Record Specialists
Ron at USMedRec.com 

More information about the Beginners mailing list