Re: [gdome]RFC: Using XSLT and SAX with XML::GDOME



On Wed, 26 Dec 2001, T.J. Mather wrote:

> Are you proposing to add a libxslt wrapper to the libgdome library as an 
> optional module if libxslt is available?

well, the thing must be studied carefully. On one side, XSLT has nothing
to do with DOM (except that it manipulates a XML tree), so having a module
*inside* gdome doesn't sound too nice to me, and AFAIK there's nothing in
DOM 3 related to XSLT. On the other side, developing a complete separate
wrapper for libxslt would require to access the internals of gdome, that,
for now, are completely hidden. This module, in fact, would be
really trivial, because all it has to do is to take two DOM trees, one
corresponding to the source XML document, one corresponding to the XSLT
stylesheet, invoke the libxslt method to do the processing and returning
the result tree (as a gdome document). We can think about having a really
simple module doing this.

> The goal is to build a XML::GDOME tree from a series of SAX events, and to 
> generate a series of SAX events from a XML::GDOME node.  I've never had to 
> do something like this, but I can see how it would be useful.

well, you can do both with the current gdome API:

a) SAX => gdome tree. Setup your callback functions and create tree nodes
as needed. The only thing to take care of are namespaces (a simple context
would do the work).

b) gdome tree => SAX. Really easy, just do a full traversal of the tree,
generating SAX events.

In both cases there's no need to know anything about the libxml tree.
Note that a) is, in my opinion, how libxml would work in a perfect
world. That is, libxml should give just a SAX implementation, and gdome
should provide a full DOM implementation, so that the DOM tree is handled
by gdome exclusively, without the (questionable) wrapping mechanism.

Regards,

	LP





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]