* Fixed union in XPATH [XPATH issues #219](https://github.com/clicon/clixon/issues/219)
This commit is contained in:
parent
783b0a4857
commit
5baf8642ea
8 changed files with 25 additions and 9 deletions
|
|
@ -488,10 +488,10 @@ text_modify(clicon_handle h,
|
|||
|
||||
/* If origin body has namespace definitions, copy them. The reason is that
|
||||
* some bodies rely on namespace prefixes, such as NACM path, but there is
|
||||
* no way we can now this here.
|
||||
* no way we can know this here.
|
||||
* However, this may lead to namespace collisions if these prefixes are not
|
||||
* canonical, and may collide with the assign_namespace_element() above (but that
|
||||
* is for element sysmbols)
|
||||
* is for element symbols)
|
||||
* Oh well.
|
||||
*/
|
||||
if (assign_namespace_body(x1, x1bstr, x0) < 0)
|
||||
|
|
|
|||
|
|
@ -34,6 +34,14 @@
|
|||
|
||||
* Clixon XML XPATH 1.0 according to https://www.w3.org/TR/xpath-10
|
||||
*
|
||||
* Note on xcur parameter to most xpath functions:
|
||||
* The W3 standard defines the document root / element as the top-level.
|
||||
* In the clixon xpath API, the document root is defined as the top of the xml tree.
|
||||
* The xcur argument of xpath_first and others is the "current" xml node (xcur) which can
|
||||
* be any node in that tree, not necessarily the document root.
|
||||
* This is convenient if you want to use relative xpaths from any location in the tree (eg ../../foo/bar).
|
||||
* It may be confusing if you expect xcur to be the root node.
|
||||
*
|
||||
* Some notes on namespace extensions in Netconf/Yang
|
||||
* 1) The xpath is not "namespace-aware" in the sense that if you look for a path, eg
|
||||
* "n:a/n:b", those must match the XML, so they need to match prefixes AND name in the xml
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ addexpr : addexpr ADDOP unionexpr { $$=xp_new(XP_ADD,$2,NULL,NULL,NULL,$1, $
|
|||
;
|
||||
|
||||
/* node-set */
|
||||
unionexpr : unionexpr '|' pathexpr { $$=xp_new(XP_UNION,A_NAN,NULL,NULL,NULL,$1, $3);clicon_debug(3,"unionexpr-> unionexpr | pathexpr"); }
|
||||
unionexpr : unionexpr '|' pathexpr { $$=xp_new(XP_UNION,XO_UNION,NULL,NULL,NULL,$1, $3);clicon_debug(3,"unionexpr-> unionexpr | pathexpr"); }
|
||||
| pathexpr { $$=xp_new(XP_UNION,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(3,"unionexpr-> pathexpr"); }
|
||||
;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue