Hi All,
I'm having two issues when using libxml and its with my code only.
But please let me know, how to get this fixed.
1. A problem with the memory issue, I guess.
With the below piece of code, in the constructor I have already created
a xpathCtx = xmlXPathNewContext(tree);
And then, I have written a xpatheval method, which gets the path to be
evaluated.
Because I evaluate the xpath expression in many places, I have written
this method.
But with this, sometimes there is a segmentation fault in the
xmlXPathEvalExpression( ) call.
(when executing 10 times, twice it gives segv). How can I debug the
memory issues with the libxml api's call
or what could be wrong here?
xmlNodeSetPtr OTAccess::OTxmlXPathEvalExpression(string path)
{
const xmlChar* cpath = xmlCharStrdup(path.c_str());
xpathObj = xmlXPathEvalExpression(cpath, xpathCtx);
xmlFree((void*)cpath);
return (xpathObj->nodesetval);
}
2. Another problem is, I wrote a test program which sets the content of an
element
using xmlNodeSetContent(pnode, "100.100.100.100"), which is working
fine.
But when I used it in my actual code, xmlNodeSetContent(pnode, "
100.100.100.100"), it gives the following error.
Access.cpp:100: error: invalid conversion from 'const char*' to 'const
xmlChar*'
Access.cpp:100: error: initializing argument 2 of 'void
xmlNodeSetContent(xmlNode*, const xmlChar*)'
Should I need to type cast to const xmlChar*. Even then, how it worked
in the test program.
Please help me to fix these problems.
Thanks
Senthil
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml