Re: [xml] help: how to get content of an element via XPath in lib xml2
- From: Daniel Veillard <veillard redhat com>
- To: andy glew amd com
- Cc: xml gnome org
- Subject: Re: [xml] help: how to get content of an element via XPath in lib xml2
- Date: Thu, 24 Apr 2003 16:49:39 -0400
On Thu, Apr 24, 2003 at 11:40:25AM -0700, andy glew amd com wrote:
You understand that
xmlXPathEvalExpression(document,"/record/field"))
returns a node set, that a node set may potentially contain 0, 1 or N
nodes. A nodeset is not a node, you can't xmlGetContent() the result !
I understand the difference between nodesets and nodes.
Actually xmlXPathEvalExpression
returns an xmlXPathObjectPtr.
I am having trouble figuring out
how that maps into a xmlNodeSetPtr.
Read the data definitions, they are public !
if (obj->type == XPATH_NODESET) {
xmlNodeSetPtr nodes;
nodes = obj->nodesetval;
if ((nodes != NULL) && (nodes->nodeTab != NULL)) {
int i;
for (i = 0;i < nodes->nodeNr;i++) {
handle(nodes->nodeTab[i]);
}
}
}
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.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]