[gdome]RFC: Using XSLT and SAX with XML::GDOME
- From: "T.J. Mather" <tjmather tjmather com>
- To: <perl-xml ActiveState com>
- Cc: <gdome gnome org>
- Subject: [gdome]RFC: Using XSLT and SAX with XML::GDOME
- Date: Wed, 26 Dec 2001 14:52:47 -0500 (EST)
One of the next steps for XML::GDOME was to add the ability to
transform XML::GDOME trees to XML::LibXML trees and vice-versa.
A reason to do this was to be able to access the XSLT and SAX functions
that XML::LibXSLT and XML::LibXML provide. However, we are not tied to
using transforms to XML::LibXML documents to provide XSLT and SAX.
So, what is the best way of providing XSLT and SAX functions for
XML::GDOME? Is there any other reason to provide transforms to
XML::LibXML besides the ability to access the XSLT and SAX functionality?
XPath should be coming to GDOME soon.
Here are three proposed ways of providing XSLT and SAX to GDOME:
1. Add ability to go from XML::GDOME trees to XML::LibXML trees and back.
For example,
# XML::GDOME::Document method that returns a XML::LibXML::Document object
$libxml_doc = $gdome_doc->toLibXML;
# returns a XML::GDOME::Document object
$gdome_doc = XML::GDOME->createDocFromLibXML($libxml_doc);
The biggest challenge here would be the memory management. What happens
when a tree is freed by GDOME but still referenced by XML::LibXML? or
when a tree is freed by XML::LibXML but still referenced by GDOME?
One possible way of approaching this is to be able to register a callback
with XML::LibXML that will be called instead of having the libxml tree
freed. So XML::GDOME would register a callback that would decrement its
reference count of the document, freeing the libxml if there were no more
references to it from XML::GDOME.
2. Include XSLT and SAX code from XML::LibXML in XML::GDOME, modified to
work on gdome trees instead of libxml trees.
This would avoid the memory management problems, but would branch the
XSLT and SAX XS code in XML::LibXML/XSLT. This would probably be the
cleanest solution, since the user would always be in XML::GDOME space,
instead of having to switch back and forth between LibXML and GDOME. It
also has the advantage of not requiring any changes to the XML::LibXML
and XML::LibXSLT packages.
3. Modify XSLT and SAX code in XML::LibXML to work with both gdome trees
and libxml trees.
The idea being that the LibXML/XSLT XS code would be able to work with
XML::GDOME documents as well as XML::LibXML documents. However, this
might be too complicated and risky to be included in the
XML::LibXML/LibXSLT packages.
Cheers,
TJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]