Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving all nodes: ly_ctx_get_node() vs. lyd_get_node() #86

Closed
milanlenco opened this issue Jul 6, 2016 · 1 comment
Closed

Retrieving all nodes: ly_ctx_get_node() vs. lyd_get_node() #86

milanlenco opened this issue Jul 6, 2016 · 1 comment

Comments

@milanlenco
Copy link

Some time ago we were discussing that in order to get all the nodes of a module, the xpath /test-module:*//. should be used rather than /test-module:*//*.
But after we replaced * with . in our test applications, we started to observe the following error:
libyang: Unexpected character(s) '*' (*//.).
It turned out that while lyd_get_node() processes this xpath just fine, ly_ctx_get_node() returns this error. Is there a difference between these two functions related to the input xpath that we should be aware of?

Thanks,
Milan

@michalvasko
Copy link
Member

Hi Milan,
if you read the function documentation carefully, you will notice that ly_ctx_get_node() accepts "schema node identifier in JSON format", while ld_get_node() an "XPath expression". The difference is explained in more detail in the general documentation, which is available if you execute make doc. Look into the HTML documentation libyang/How To.../XPath Addressing. Very briefly, the reason for the difference is that ly_ctx_get_node() is evaluated on schema.

Regards,
Michal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants