[REBOL] Re: XML document formats?
From: rasmussen:bryan:gmai:l at: 22-Mar-2006 22:54
basically the difference is as expressed in the thread, what do you
want to do, SAX is a streaming api therefore used for manipulating
large documents, especially if you only want to extract data, the Dom
reads the whole tree into memory. Thus there can be performance
differences between these two.
However there is another difference, that being that a lot of
developers find SAX counter intuitive, and Dom not so counter
intuitive.
There's a saying somewhere: "SAX is too hard, Dom is too weak."
However they are just two different API's, not the only ones out
there. Rebol could have its own, if it had a XML and Namespaces
conformant parser(everyone is namespace conformant nowadays)
Xpath can be considered another API for getting at data in an XML
document. Most DOM implementations allows you to to basically pass
XPaths to get back a portion of the document that you then work with
as shown in this article from Microsoft:
http://msdn.microsoft.com/msdnmag/issues/0900/xml/
I personally think XPath support is more essential than either of the
other two, for example in .Net one makes a lot of use of XmlReaders,
thus it can be shown that if someone has a better way it can work, but
it must also be conformant (of course being from MS does not hurt):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconReadingXMLWithXmlReader.asp
A propos my suggestion for Libxml, then I would hope it would be
possible to port libgdom http://gdome2.cs.unibo.it/ and thus have a
dom implementation
of course it should be noted that Libxml has partial implementations
of both SAX and DOM in the core library, but these are not supposed to
100% conformant.
Aside from all this, of the two DOM has higher mindshare, and it is a
W3C specification.
In the context of how a Rebol-ish XML api might work one could look at
SXML, a scheme project http://okmij.org/ftp/Scheme/xml.html
On 3/22/06, Petr Krenzelok <petr.krenzelok-trz.cz> wrote: