-
Hey there, I'm rather new to libyang and it might be that I have not fully understood xPath as I have only worked with the Python implementation previosuly, but to me the following behavior of libyang seems unexpected: I am currently trying to parse a list of struct ly_set *set1 = nullptr;
lyd_find_xpath(child, "/ietf-interfaces:interfaces/interface", &set1);
for (uint32_t i = 0; i < set1->count; i++) {
struct ly_set *set2 = NULL;
lyd_find_xpath(set1->dnodes[i], "//name", &set2);
fprintf(stdout, "Interface %d, count %d\n", i, set2->count);
for (uint32_t i = 0; i < set2->count; i++) {
fprintf(stdout, " name: %s", lyd_get_value(set2->dnodes[i]));
}
ly_set_free(set2, NULL);
}
ly_set_free(set1, NULL); I would expect this code to loop over all Maybe worth noting I am using the latest libyang from I highly appreciate any help/feedback on this! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Ok I didn't realize a relative xpath would be specified using |
Beta Was this translation helpful? Give feedback.
Ok I didn't realize a relative xpath would be specified using
name
instead of//name
, which works as intended :)