Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting list of all properties of a node using libxml

Tags:

c

xml

libxml2

I'm having trouble to find a way to extract a list of all properties of a node without knowing what they're called.

I'm extracting single known properties using:

xmlGetProp(cur, (const xmlChar*)"nodename")

But how to get a list of all properties using libxml2?

Regards, marius

like image 271
Marius Avatar asked Dec 16 '09 09:12

Marius


1 Answers

Simply loop through the node's properties list, ie:

xmlNodePtr Node = ...;
for(xmlAttrPtr attr = Node->properties; NULL != attr; attr = attr->next)
{
    ... do something with attr ...
    ... the name of the attribute is in attr->name ...
}
like image 142
Remy Lebeau Avatar answered Sep 22 '22 21:09

Remy Lebeau