[xml] XPath: Get element content as string



Hello @all,


i'm trying to receive the string value of an
element (content) using a XPath expression like

"//foo[string()]"

e.g:

resultObj = xmlXPathEval(BAD_CAST "//foo[string()]", ctxt);

The resulting XPathObject has the type XPATH_NODESET and
contains one node (of course "foo").
So i can call

contStr = xmlXPathCastToString(resultObj);

to receive the content.
Well, that's fine so far. I'm just wondering if this
is the correct way. I'm just a beginner WRT XPath and
i've thought that the "string()" function (w/o parameter)
should result in a string object.
In addition the struct "xmlXPathObject" has a member
"strval" and a possible type "XPATH_STRING".

So, my question is: Is there a API routine that i've
missed and that results in a "xmlXPathObject" with
type "XPATH_STRING" and holds the string value of
a (via XPath expression) given context node?


TIA, Markus


________________________Addressed by:________________________
 ORDAT GmbH & Co. KG  -  Serversystems / eCom 
 Dipl.-Inf. (FH) Markus Henke  Fon: +49 (641) 7941-0
 Rathenaustr. 1                Fax: +49 (641) 7941-132
 35394 Gießen                  mailto:markus henke ordat com
 See:                          http://www.ordat.com
_____________________________________________________________
              ...this behavior is by design...

Attachment: Markus Henke.vcf
Description: Binary data



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