Re: [xml] Re: [xslt] libxslt effects on _private member of libxml structures
- From: Steve Ball <Steve Ball zveno com>
- To: xslt gnome org
- Cc: Luca Padovani <lpadovan CS UniBO IT>, xml gnome org, Claudio Sacerdoti_Coen <sacerdot CS UniBO IT>
- Subject: Re: [xml] Re: [xslt] libxslt effects on _private member of libxml structures
- Date: Wed, 26 Mar 2003 09:51:07 +1100
Daniel Veillard wrote:
On Tue, Mar 25, 2003 at 11:47:20AM +0100, Luca Padovani wrote:
an hash-table maybe?
And libxslt is gonna do an hash-table lookup for each and
every node of input processed ? Nope the information that the node is
keyed need to go in the node itself.
Of course not. However, my TclDOM/libxml2 binding has also
mis-interpreted the intent of the "_private" field and so
is exposed to problems similar to gdome.
My plan for the next major release of the Tcl binding was to
avoid using _private altogether. However, the thought did
occur some time ago that perhaps there needs to be a standard
mechanism for an application/library to hang data off a node?
What if a Tcl script using libxml2 wanted to pass an
xmlDoc to a gdome library (and back again)?
Each application could use a hash table, but the various applications
also want to be (time-) efficient. Of course, providing every
application with its own separate hook may blow-out the size of an
xmlNode.
PROPOSAL: Add a "_apphooks" field to xmlNode and xmlDoc for
application data. This would be a pointer to a "xmlAppHook"
struct where applications can be allocated a per-node/per-doc
pointer. Each application should register itself with
libxml2, and the xmlAppHook struct will be dynamically sized
according to the number of applications registered. The registration
API would return an index into the xmlAppHook struct allocated
to that application.
Obviously applications can only register themselves at startup time.
Lame attempt at ascii art:
+--xmlNode--+ +----------+
| | | libxslt |
| _private | ---> +----------+
| |
| _apphooks | ---> +-xmlAppHook-+
| | | |
+-----------+ | idx 0 |
| |
| idx 1 | ---> +--myData--+
+------------+ | |
| whatever |
+----------+
In this case, 'xmlRegisterApplication("gdome")' returned 0
and 'xmlRegisterApplication("tcldom")' returned 1.
To find my data I would use nodePtr->_apphooks[1]
Costs:
* Adds another pointer to the xmlNode and xmlDoc structs.
* Applications must lookup two pointers to find their data.
However, that's better than a hash table lookup.
* More APIs required.
Benefits:
* Applications avoid clashing with libxml2, libxslt and each other.
Cheers,
Steve Ball
--
Steve Ball | XSLT Standard Library | Training & Seminars
Zveno Pty Ltd | Web Tcl Complete | XML XSL Schemas
http://www.zveno.com/ | TclXML TclDOM | Tcl, Web Development
Steve Ball zveno com +---------------------------+---------------------
Ph. +61 2 6242 4099 | Mobile (0413) 594 462 | Fax +61 2 6242 4099
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]