[xml] Apparent libxml documentation error?



I hope to have subscribed to the list, but maybe I haven't. I have
been using C for around twenty years, but today, I started reading the
tutorial in the documentation of libxml, and I have not began trying
to use it. It may be my own misunderstanding, but it would seem that
"Appendix D. Code for the XPath Example" should be changed to have the
context freed whether or not a node was found. Anyway, I will
thoroughly enjoy using what I am learning with this wonderful thing.
Thank you.

diff -rU4 old/apd.html.c new/apd.html.c
--- old/apd.html.c      2011-09-24 19:20:26.178522000 -0400
+++ new/apd.html.c      2011-09-24 19:21:11.466112300 -0400
@@ -23,9 +23,9 @@
        context = xmlXPathNewContext(doc);
        result = xmlXPathEvalExpression(xpath, context);
        if(xmlXPathNodeSetIsEmpty(result->nodesetval)){
                 printf("No result\n");
-               return NULL;
+               result = NULL;
        }
        xmlXPathFreeContext(context);
        return result;
 }



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