Re: [xml] Xpath Question



Alistair Leslie-Hughes wrote:
Hi,

I have the following XML
<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string>C4TJXQFL</string>

and using msxml I can do "selectSingleNode("string")" to select the root node.

Is there an xmlXPath or equivalent function? (assume that I cannot change the "string" parameter)


xmlDocPtr doc;
...
xpctxt = xmlXPathNewContext(doc);
xpobj = xmlXPathEvalExpression("/string", xpctxt);
if(xpobj->nodesetval->nodeNr)
  xmlNodePtr string_root_node = nodeSet->nodeTab[0];
...

(error checks and freeing stuff omitted.)

br,
Martin



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