Re: [xml] Retrieving boolean/number/string value from XPath objects

On Fri, May 11, 2001 at 02:59:57PM +0200, Thomas Broyer wrote:

Today I started implementing EXSLT's extensions ( and I

  Good idea ! I kept the URL around but since I didn't finished the 
extension API, I decided to postpone. getting this contribution would
indeed be very cool :-)

came to a reflexion I already had last fall while we were talking about

Why isn't there "basic" functions to convert values to

  Probably because I never took the time to do refectoring, and also
probably because I usually do most of those "in-situ" in the allocated
XPath object being passed (this is the case I think for the most simple
XPath casts).

I'm convinced there should be functions or macros to:
 · convert a "basic" value (xmlChar*, double, int, xmlXPathNodeSet) to
   another one (xmlChar*, double, int)
 · convert an XPath object to a "basic" type (xmlChar*, double, int)
and I can't understand why there aren't yet.
This would simplify other functions like sum() or even id() (and document()
in libxslt) and avoid useless allocations/deallocations in many programs
based on libxml or extension functions.

The current functions for casting XPath objects to XPath objects should
rely on these "low-level" functions.

The basic idea is to work on xmlXPathObject's only at the beginning (when
you receive arguments) and end (when you return values) of functions to
avoid allocations/deallocations and not-instinctive manipulation of

  Yes there is definitively a lot of places in the XPath library where
allocations are far from optimal !

Should I go for it or you disagree with such a refactoring?

  No it's a good idea, try to preserve the semantic of the existing
operation (including numbers ones ;-)


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

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