[xml] Newbie Help



Please help!

I have generated an xml file using kxmleditor.  With libxml, I am trying to use the xpath interface to retrieve a node list for the elements in my file.  The document has (currently) a three level hierarchy and I am trying to retrieve data from the inner most tier.  My code snippet:

if(!(xmldoc=xmlParseFile("statics.xml"))) break;
xpath_context=xmlXPathNewContext(xmldoc);
xpath_object=xmlXPathEvalExpression((xmlChar*)"root/main_ui/config_menu/*",xpath_context);

When I run my code, I get the following error messages:

xmlXPathNodeCollectAndTest xpath.c:1923 : nodelist and node are NULL
xmlXPathNodeCollectAndTest xpath.c:1923 : nodelist and node are NULL
xmlXPathNodeCollectAndTest xpath.c:1923 : nodelist and node are NULL
xmlXPathNodeCollectAndTest xpath.c:1923 : nodelist and node are NULL

Apparently, each one of these error messages corresponds to each level of the hierarchy.  I have tried many permutations of the same _expression_.  In all cases xpath_object is returned invalid.  I suspect my syntax for the _expression_ is wrong, but I cannot figure it out.
 
Also, I have studied the code example at http://www.xmlsoft.org/tutorial/apd.html and have reviewed the syntax for xpath as describe here http://www.w3.org/TR/xpath#section-Introduction.  Neither has helped.  As far as I can tell, my code is really the same as that provided by the example.  Please help!

Thanks in advance,
Bryan Christ




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