Next: The DOM tree
Up: Design Issues
Previous: Object-Orientation
Although the DOM Architecture can be used for the creation of new documents
not residing in some external resource, a DOM Implementation is usually
not a piece of stand-alone software: in most cases, it is added as a separation
layer between a XML parser and user applications.
The distinction between the parser and the DOM implementation is not always
so definite. For example, a DOM implementation can provide its own parsing
module, so that the DOM layer appears as the lowest one from the application
point of view. Alternatively, the XML parser could only be responsible to generate
a proper sequence of SAX events, and then it is up to the DOM implementation
to create the internal document representation.
As we will see, the approach used in Gdome2 is somehow an hybrid of the two scenarios
previously depicted. In fact, Gdome2 is based on the XML C library for Gnome
(libxml24 for short) which is much more than an mere XML parser.
With respect to parsing, libxml2 exports three kinds of interfaces:
- a SAX event-based interface;
- a Pull method, which parses a whole document and then returns
a corresponding document structure;
- a Push method, where the document is parsed on demand, as the
application requires for more chunks to be parsed. This method is
conceived to be used, for example, in interactive applications where it
is not feasible to block the whole process while parsing a large
document.
In particular, the last two methods build a libxml2-dependent tree representation
of the document which largely borrows from the DOM core specification, and this
is a crucial aspect of the whole Gdome2 implementation, as we will see.
Footnotes
- ...
(libxml24
- http://xmlsoft.org
Next: The DOM tree
Up: Design Issues
Previous: Object-Orientation
Paolo Casarini
2001-04-01