[xml] MacOSX specific problem when using xmlXPathNodeSetIsEmpty()
- From: Håkon Skjelten <skjelten pvv org>
- To: xml gnome org
- Subject: [xml] MacOSX specific problem when using xmlXPathNodeSetIsEmpty()
- Date: Thu, 17 Jun 2004 23:14:11 +0200
Hi
I'm working on a project where we use libxml2 to store level data. The code
works perfectly on GNU/Linux (PPC/i386/AMD64) but it fails on MacOSX.
The code that fails is the xmlXPathNodeSetIsEmpty(_query->nodesetval)
function call. For some reason it returns TRUE on MacOSX even though this is
not correct (same code & XML file returns FALSE in GNU/Linux). All other
libxml2 functions seems to work fine on the Mac.
The method that fails:
int XMLParser::query_start(std::string xpath)
{
if (_query != NULL)
return -1;
_query_element = 0;
xmlXPathContextPtr context = xmlXPathNewContext(_xmlDocument);
_query = xmlXPathEvalExpression( (xmlChar*)xpath.c_str(), context);
xmlXPathFreeContext(context);
/*
This does not work either:
if (xmlXPathNodeSetGetLength(_query->nodesetval) == 0) {
*/
if (xmlXPathNodeSetIsEmpty(_query->nodesetval)) {
_query_matches = 0;
_query_attr = NULL;
} else {
_query_matches = _query->nodesetval->nodeNr;
_query_attr = _query->nodesetval->nodeTab[0]->properties;
}
return 0;
}
_query_matches always equals 0 on MacOSX (and if I skip the entire test and
set _query_matches = _query->nodesetval->nodeNr; I get a segmentation fault).
The same problem occur both on old and new versions of libxml2.
Is this a known problem? Are there any known workarounds? Suggestions?
Regards,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Håkon Skjelten (skjelten pvv org)
Student, Engineering Cybernetics
Norwegian University of Science and Technology
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]