[xml] XPointer with libxml 2.5.10 on win32



Title: Message
Hi,
 
I have the following simplified XML tree
<document>
    <installation id='121'>
        <customer name='foo'/>
    </installation>
    <installation id='25'>
        <customer name='bar'/>
    </installation>
</document>
 
I have a function which manage an 'installation' node and I'm trying to get customer name with XPointer with the following code:
 
void ManageInstallation (xmlDocPtr doc, xmlNodePtr pnode)
{
 xmlXPathContextPtr context;
 xmlXPathObjectPtr result;
 
 context = xmlXPtrNewContext(doc, pnode, NULL);
 if (!context) return;
 xmlChar *_expression_ = BAD_CAST "customer name";
 
 result = xmlXPtrEval(_expression_, context);
    if (!result) return;
 
 xmlChar * resultString = xmlXPathCastToString(result);
     if (resultString) {
 printf("%s\n", resultString); /* utf8 */
    }
 
    xmlXPathFreeObject(result);
    xmlXPathFreeContext(context);
}
 
the problem is that result is NULL even if I call xmlXPtrNewContext(doc, NULL, NULL)
 
Jérôme


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