Получение списка всех свойств узла с помощью libxml

Я испытываю затруднения для нахождения способа извлечь список всех свойств узла, не зная то, чем их называют.

Я извлекаю единственное известное использование свойств:

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

Но как получить список всех свойств с помощью libxml2?

С уважением, marius

5
задан Marius 10 January 2010 в 10:11
поделиться

2 ответа

Просто прокрутите список свойств узла, например:

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 ...
}
12
ответ дан 13 December 2019 в 05:36
поделиться

Interesting, does not appear to be a method that does this (though oddly there is xmlFreePropList function), but the xmlNode structure has a pointer to a list of the properties (attributes) of the node. You can probably get a pointer to that structure.

0
ответ дан 13 December 2019 в 05:36
поделиться
Другие вопросы по тегам:

Похожие вопросы: