Re: [xml] Still some words about XPath

Le 14/05/01 18:54:25, Daniel Veillard a écrit :
 · is there any good reason not to have a function xmlXPathNewObject
   instead of copying the allocation code in every xmlXPathNew*

  Might make sense. On the other hand it's one more function call
in a relatively critical path.

It may eventually be a macro.

 · xmlXPathNewNodeSet returns an "empty node-set" object when it is
   passed NULL, whereas xmlXPathNewNodeSetList returns NULL and
   xmlXPathWrapNodeSet returns an empty object (obj->nodesetval is
   xmlXPathNewNodeSet is consistant with xmlXPathNewString and

Actually, xmlXPathNewCString returns en empty object (stringval is NULL) if
it is passed a NULL argument.

  Yes this makes sense, there is places where one want to create
the node set "before" for example before a loop without failing.

So what should the "normal" behaviour be?

IMO the one of xmlXPathWrapNodeSet and xmlXPathNewCString to prevent
useless allocations. stringval == NULL and stringval == "" should be
considered equivalent (an empty string), idem for nodesetval == NULL and
nodesetval->nodeTab == NULL.

 · is there any good reason keeping unused structures and types in

  Once it's public, it's public until a new API breakage, i.e. libxml3
maybe never... they are probably reused in xpathInternals.h too.

I was thinking of xmlXPathConvertFunc, xmlXPathType, xmlXPathVariable,
xmlXPathAxisFunc and xmlXPathAxis.
There isn't any function using them, they are completely useless and


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