Re: [xml] Retrieving boolean/number/string value from XPath objects
- From: Daniel Veillard <veillard redhat com>
- To: Thomas Broyer <tbroyer ltgt net>
- Cc: xml gnome org
- Subject: Re: [xml] Retrieving boolean/number/string value from XPath objects
- Date: Fri, 11 May 2001 09:19:23 -0400
On Fri, May 11, 2001 at 02:59:57PM +0200, Thomas Broyer wrote:
Hi,
Today I started implementing EXSLT's extensions (http://exslt.org) 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
libxslt.
Why isn't there "basic" functions to convert values to
number/boolean/string?
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
xmlXPathObject's.
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
--
Daniel Veillard | Red Hat Network http://redhat.com/products/network/
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]