Re: [xml] XPath on a subtree



On Sun, Mar 31, 2013 at 06:44:44PM +0800, Daniel Veillard wrote:
On Sat, Mar 30, 2013 at 07:11:35PM +0000, Alex Bligh wrote:
BTW the xml is generated so that should be discarded from the
patch,

That's strange. It appears in git and has a history.
  https://git.gnome.org/browse/libxml2/tree/doc/libxml2-api.xml

How does one regenerate it (as the normal build process
didn't)?

  Ah, well usually I do this only at release times, but it can
be useful when developping a patch too, so have a look at
doc/apibuild.py

  It is a large bit of rather ugly Python, but it scans the .h
files, the .c files, and generate a formal API description of
all exported entry points and structures:
  doc/libxml2-api.xml

From there a number of other things are generated such as the
online docs, checks for the exported symbol files, python
bindings ...

  Ah, another thing which is generated from it is testapi.c
(make rebuild_testapi) which is used to exercise the full set of
the API against weird input etc ...

....
Testing xpath : 32 of 40 functions ...

Program received signal SIGSEGV, Segmentation fault.
0x00000000004f9691 in xmlXPathSetContextNode (node=0x82bd50, ctx=0x0)
    at xpath.c:15091
15091       if (node->doc == ctx->doc)

 and it indicates you forgot to check the arguments from that new
function. There is actually a number of possible error case so
it is better to make the function return an error status,
I also modified xmlXPathNodeEval to return NULL if str is NULL or
if xmlXPathSetContextNode failed :-)

I commited the result:

  https://git.gnome.org/browse/libxml2/commit/?id=28876afb4e67f9f4292fc2a7134f6b97f0618b7d

 thanks !

Daniel

-- 
Daniel Veillard      | Open Source and Standards, Red Hat
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/


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