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

lyd_new_path API not work with concat #2275

Open
NextLitete opened this issue Aug 2, 2024 · 1 comment
Open

lyd_new_path API not work with concat #2275

NextLitete opened this issue Aug 2, 2024 · 1 comment
Labels
is:question Issue is actually a question.

Comments

@NextLitete
Copy link
Contributor

The concat function is used to correctly process the single quotation mark (') and double quotation mark (") in the node value. But the lyd_new_path API doesn't seem to support it. Do you have any better suggestions? Thanks!

uint32_t options = LYD_NEW_PATH_CANON_VALUE | LYD_NEW_PATH_OUTPUT | LYD_NEW_PATH_UPDATE;
lyErr = lyd_new_path(root, ctx, path.c_str(), value, options, nullptr);

err_path:
lyd_new_path err[7], path:/openconfig-telemetry:telemetry-system/destination-groups/destination-group[group-id=concat("'",'"')]/config/group-id
err_msg:
lyd_new_path err[7], errmsg:Unexpected XPath token "FunctionName" ("concat("'",'"')"), expected "Literal"

@jktjkt
Copy link
Contributor

jktjkt commented Aug 5, 2024

These functions are documented to take a path, not an XPath. The grammar for path follows the instance-identifier from the grammar in RFC 7950. No XPath functions are allowed in there, so you cannot use concat().

Are you maybe looking for a way of allowing list key values with both " and '? That's just not possible in the YANG ecosystem I'm afraid.

@michalvasko michalvasko added the is:question Issue is actually a question. label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:question Issue is actually a question.
Projects
None yet
Development

No branches or pull requests

3 participants