[xml] How to use XPath to retrieve the "leaf" item?



// Newbie alert...

I am evaluating the possibility of migrating my XML code to libxml2.

This question refers to the sample program "xpath1.c".

I have been trying several XPath implementations (Xerces-C, XQilla) which return the item needed in this format:

XPath query: /table/properties/length
Result: <length units="ft">62.42</length>

which is easy enough to parse. Next, I made a discovery: If I add an extra function at the end of the string, I obtain exactly what I need:

XPath query: /table/properties/length/text()
Result: 62.42


That function works properly with all XPath implementations that I have tried, EXCEPT with libxml.

Result (1 nodes):
= node "text": type 3

I need the last step, after the node set. How do I retrieve that end item?

TIA,

-Ramon




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