Re: [xml] Newbie Help
- From: Daniel Veillard <veillard redhat com>
- To: Bryan Christ <bryan christ hp com>
- Cc: xml gnome org
- Subject: Re: [xml] Newbie Help
- Date: Mon, 9 Aug 2004 15:45:38 -0400
On Mon, Aug 09, 2004 at 02:39:10PM -0500, 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
The current node is not defined. Strange but possible,
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.
Try /root/main_ui/config_menu/* The leading / ask XPath to start
from the root of the document.
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!
Check that example:
http://xmlsoft.org/examples/index.html#xpath1.c
but it looks really similar.
Daniel
--
Daniel Veillard | Red Hat Desktop team http://redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]