[sysrepo-devel] sr_xpath_key_value() changes xpath value

Milan Lenčo Milan.Lenco at pantheon.tech
Tue Oct 18 09:05:07 UTC 2016


Hi Jimmy,


the functions from sysrepo/xpath.h do modify the xpath in order to avoid any string duplications. You can always go back to the original xpath using sr_xpath_recover.

Unit tests might help you to better understand the use of sysrepo xpath utilities: tests/xpath_utils_test.c


Regards,

Milan

________________________________
Od: Jimmy Jin <jjin62 at yahoo.com>
Odoslané: 18. októbra 2016 0:23
Komu: Sysrepo-public
Predmet: [sysrepo-devel] sr_xpath_key_value() changes xpath value

Hi,
When I call

char *sr_xpath_key_value(char *xpath, const char *node_name, const char *key_name, sr_xpath_ctx_t *state);

the xpath passed in seems be changed. It truncates the string after the key. Is this expected? I need to duplicate the xpath, in order to preserve the original string.

regards,
Jimmy
MilanLenčo
Software Developer

Sídlo / Mlynské Nivy 56 / 821 05 Bratislava / Slovakia
R&D centrum / Janka Kráľa 9 /  974 01 Banská Bystrica / Slovakia
/ Milan.Lenco at pantheon.tech
reception: +421 2 206 65 114 / www.pantheon.sk

[logo]


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sysrepo.org/archives/sysrepo-devel/attachments/20161018/82fdb852/attachment.html>


More information about the sysrepo-devel mailing list