-
Notifications
You must be signed in to change notification settings - Fork 292
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
XPath is not evaluated over anydata nodes #2301
Comments
I think that XPath evaluation doesn't cross OTOH, when I read the docs, I see that |
Thank you for the quick response, and thank you for the C++ reference I need to spend more time with it as I'm not very familiar with the C++ bindings. for |
You are considering We can discuss changing this but there are some problems bound to arise. For example, paths that cross module top-level nodes inside the path are supported for |
Thank you Michal for the explanation, however, So, I'm trying to dig a bit in the code just to understand better what's going, I noticed that in line https://github.com/CESNET/libyang/blob/master/src/tree_data_new.c#L289 the parent for So my question, why is the parent of any is null? not the any data node? or it's parent? |
Fair enough, printer does traverse these nodes.
Because the contents of |
Is there a fundamental reason for that? or just implementation details? When parsing YANG data, I would assume yang will have one data tree not many. |
The main reason is that a standard YANG data should begin with instances of top-level schema nodes and then include any descendants as children. In this case there would, again, be top-level nodes, which is confusing and may even cause ambiguities when referencing these nodes. Also, this rule is broken because of |
I using latest libyang from master to query YANG data trees with XPath, but I noticed XPath evaluation is skipping the anydata nodes. Is that by design or there's a bug somewhere?
To clarify my issue. In the following example, I'm trying to use XPath over a yang push notification. What comes after is defined as
anydata
in the schema. I can query everything for the following xpath/ietf-yang-push:push-change-update/ietf-yang-push:datastore-changes/ietf-yang-push:yang-patch/ietf-yang-push:edit/ietf-yang-push:value
but it returns nothing for this xpath/ietf-yang-push:push-change-update/ietf-yang-push:datastore-changes/ietf-yang-push:yang-patch/ietf-yang-push:edit/ietf-yang-push:value/ietf-interfaces:interfaces
The output is:
The text was updated successfully, but these errors were encountered: