Re: [xml] Newbie Help



Bryan Christ wrote:

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


------------------------------------------------------------------------

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
have you tried 'BAD_CAST "/root/main_ui/config_menu/*"' ?



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