Hello,
I think I have found an issue in this tutorial: http://xmlsoft.org/tutorial/apd.html
I am providing a patch (xpath.c.patch), but not sure if you’ll agree with it.
The call to function xmlNodeListGetString has been removed, and now there is a lookup for the value directly in the xmlNode structure.
The reason being, is this query does not work: "/story/storyinfo[author/@id="2"]/author/text()"
I updated the sample code to accept the query on the command line, and it coredumps with above, because the function xmlNodeListGetString returns NULL. For test, I used xpath.xml document, and ran this query: ./xpath xpath.xml "/story/storyinfo[author/@id="2"]/author/text()"
If anyone has any other suggestions as to how the coredump can befixed, without modifying the query, as I believe it’s valid, please let me know.
I understand that this query would work: /story/storyinfo[author/@id="2"]/author But I don’t see why valid query such as original should fail, unless it’s invalid, than please explain why.
We are coding application calling these API’s, and I would like to know if my fix to sample program is valid, and could be incorporated into the application, or if some other function should be called to get the value (maybe actually the function xmlNodeListGetString should be updated?).
Thank you. Alex
|
Attachment:
xpath.c.patch
Description: xpath.c.patch
Attachment:
xpath.xml
Description: xpath.xml