Re: [xml] Xpath question
- From: "Yong Chen (yongche)" <chen cisco com>
- To: <veillard redhat com>, <xml gnome org>
- Subject: Re: [xml] Xpath question
- Date: Thu, 11 Jan 2007 19:05:36 -0800
Thanks Daniel. I did some tests for xmlSaveTree, it basically prints out
the selected nodes and their children.
Is there any way to print out the selected nodes and their parents (till
root)? I can certainly do the traversal via node->parent. Just in case
you already have some API available (which will trim the non-selected
nodes from the original doc and do xmlDocDump(stdout, doc)).
Thanks,
Yong Chen
-----Original Message-----
From: Daniel Veillard [mailto:veillard redhat com]
Sent: Thursday, January 11, 2007 2:07 AM
To: Yong Chen (yongche)
Cc: xml gnome org
Subject: Re: [xml] Xpath question
On Wed, Jan 10, 2007 at 05:57:37PM -0800, Yong Chen (yongche) wrote:
Hi,
I plan to use xpath in libxml2 to get a subset of a xmldoc,
I know it
can be done by calling xmlXPathEvalExpression(), the result is a
xmlXPathObjectPtr which has a "nodesetval" member pointing
to selected
nodes (of type xmlNodeSetPtr).
My question is, after getting the selected nodes, is there
any API I
can call to dump the selected nodes in xml tree format? There is a
convenient API xmlDocDump(stdout, doc) to dump the whole doc in xml
tree format, I'm looking for something like xmlDocDumpSubset(doc,
selected-nodes) to dump only the selected nodes in the doc.
See http://xmlsoft.org/html/libxml-xmlsave.html#xmlSaveTree
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
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]