Re: [xml] Is there an API for obtaining xmlNodeSetPtr for all the nodes within a xml sub-tree ?



hi,
chetan said is new to xml, and as i'm also "new" in xml, i would like to expose here my way of doing to parse children nodes of an xml document.
all apologize if it's not the topic of this list....

i'm using the tree API, i declare a node pointer on the rootelement of the doc
root = xmlDocGetRootElement(doc);

i declare a node pointer on the first child of the rootelement
node = root->children;

i make a loop while node is not null
while(node)
   {
     /*......*/
       node = node->next;
   }

with some strcmp, find and use the desired data.

is it a good way?

thanks,
nicolas
On Fri, Apr 14, 2006 at 12:07:42PM +0530, Chetan Raj wrote:
Hi All,

I am new to Libxml. I am trying to find an API in Libxml that can give me
xmlNodeSetPtr  for all the children nodes of a xml subtree.

  A node set can be one of the results of an XPath query. So you would
have to make an XPath query corresponding to the childrens. But that sounds
wrong to me, if you want to walk the children of a node it's part of the tree structure so why spend time to create artificially an extra structure
for this !

Daniel

Attachment: sl1200mk2.vcf
Description: Vcard



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