[xml] search for a match in the tree and return a node pointer



Hi,

I want to search for a match in the tree and return a node pointer. I don't know what functions to use in libxml2. Here's my code:

??? findContent (const char* searchStr, xmlNodePtr cur)
{
xmlNodePtr cur_node = NULL;
for (cur_node = cur; cur_node; cur_node = cur_node->next)
{
if (!xmlStrcmp(cur->name, (const xmlChar*)searchChar)) return ???;
else if (!xmlStrcmp(cur->name, (const xmlChar*)searchChar)) return ???;
}
}

Then, in the next function, FindAllContents(???) //something like, xmlNodePtr ptr
{
//location pointer from FindContent() is the input, output returns all items and contents for that node; what structures or functions should I use?
}

A code example would be helpful.  Thank you.

_________________________________________________________________
Tax headache? MSN Money provides relief with tax tips, tools, IRS forms and more! http://moneycentral.msn.com/tax/workshop/welcome.asp




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