"M. Farhan" wrote:
> 1 . Can we call SAX and DOM as XML Parsers??? or they are interfaces
> to access the XML document.
> 2. if we have XSLT to handle the xml documents...so why do we use DOM
> and SAX...whats the idea...please clarify the idea??
> Thanks in advance..
The system is layered:
XSLT depends on SAX or DOM. Most XSLT Processors depend on a DOM
implementation, since they don't yet handle the event-based SAX model.
SAX: creates "events" for parts of the document. You may respond to
these events. It is "asynchronous" (sort-of) in the sense that you react
to a callback from the SAX system. The xml document is read as a stream.
DOM: The DOM library reads the whole document in, and plops a big tree
in your lap.
I think, technically, SAX and DOM are not parsers, they merely implement
a particular way of accessing a document. For instance, a library may be
written to "emit" SAX events, *as if* they came from the parsing of a
document, but these events may be dynamically produced. That said, SAX
is pretty close to the bone of a parser and they are often implemented
as one library.
I hope that's made things slightly clearer (maybe not ;-) ).
[log in to unmask]