SAX:
SAX doesn't create a tree for XML nodes. It is a event based API provides a simpler, lower-level access to an XML document. Parses documents much larger than your available system memory.
DOM:
Tree based API. Map an XML document into an internal tree structure, then allow an application to navigate that tree.
Conclusion:
Use DOM to create XML documents and use SAX(fire events) to get XML data.
Next step -> SOAP and Webservices or .NET solutions..
Weird - I've just been reading that section in Mastering Delphi 6 by Marco Cantu! I think you've now answered your own question, yes?
I'm looking at XML techniques in order to parse an HTML document i.e. extract data, ignoring the tags.
I've just been looking at one of the examples that comes with the book (the XmlEditOne example) and it won't run because it can't find xmldom which is in the uses list.
Do you know how to get access to this unit?
I checked in the equivalent path and I have no XML folder in my Source folder. I did a bit of digging and it looks like I just need to download an update pack. So I'll then be able to access the dcu's mentioned in the book.
DOM reads the whole document; you can navigate around and explore the relationship between parent and child elements, but it can use a lot of memory and take a long time.
SAX is small: it fires an event every time it reads an element; the event handler does something with the element; and then the element is gone.
I wrote an XML parser that fires Begin and EndElement events so the event handler can free the elements instead of only letting it have one shot at it. This lets me keep small hierarchies in memory so I can navigate, count the number of children, etc. without having to hold the whole thing.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.