gpt4 book ai didi

c - 使用 libxml 获取节点的所有属性列表

转载 作者:数据小太阳 更新时间:2023-10-29 01:53:38 24 4
gpt4 key购买 nike

我很难找到一种方法来提取节点所有属性的列表,而不知道它们的名称。

我正在使用以下方法提取单个已知属性:

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

但是如何使用 libxml2 获取所有属性的列表?

问候,马吕斯

最佳答案

简单地遍历节点的属性列表,即:

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 ...
}

关于c - 使用 libxml 获取节点的所有属性列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1913351/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com