diff --git a/CHANGELOG.md b/CHANGELOG.md index 94b26b3a..6bffc1dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ Planned: April 2025 ### Corrected Bugs +* Fixed: [XPath * stopped working in 7.3](https://github.com/clicon/clixon/issues/594) * Fixed: [Templates with nc:operation "merge" causes bad diffs to be shows](https://github.com/clicon/clixon-controller/issues/187) ## 7.3.0 diff --git a/lib/src/clixon_xpath_eval.c b/lib/src/clixon_xpath_eval.c index bc54e8dc..43146726 100644 --- a/lib/src/clixon_xpath_eval.c +++ b/lib/src/clixon_xpath_eval.c @@ -142,6 +142,9 @@ nodetest_eval_namespace(cxobj *x, char *ns1 = NULL; /* xml namespace */ char *ns2 = NULL; /* xpath namespace */ + /* Namespaces is s0, name is s1 */ + if (strcmp(xs->xs_s1, "*")==0) + goto ok; /* XML x -> prefix1 + name1 */ prefix1 = xml_prefix(x); name1 = xml_name(x); @@ -169,9 +172,7 @@ nodetest_eval_namespace(cxobj *x, } else if (strcmp(ns1, ns2) != 0) goto fail; -#ifdef XPATH_NS_ACCEPT_UNRESOLVED ok: -#endif retval = 1; done: /* retval set in preceding statement */ return retval; diff --git a/test/test_xpath.sh b/test/test_xpath.sh index be7ff841..9a0b9a19 100755 --- a/test/test_xpath.sh +++ b/test/test_xpath.sh @@ -143,6 +143,12 @@ module clixon-example { type string; } } + container options { + leaf max-number { + type uint32; + default 50000; + } + } } } EOF @@ -556,7 +562,7 @@ EOF new "given value show key" expectpart "$($clixon_util_xpath -D $DBG -f $dir/1.xml -n ex:urn:example:clixon -y $fyang < $dir/1.xpath)" 0 "x" - +# See https://github.com/clicon/clixon/issues/594 cat < $dir/1.xpath /table/parameter[value='42']/value EOF @@ -564,6 +570,20 @@ EOF new "given value show value" expectpart "$($clixon_util_xpath -D $DBG -f $dir/1.xml -n ex:urn:example:clixon -y $fyang < $dir/1.xpath)" 0 "42" +cat < $dir/1.xml + + + 50000 + +
+EOF + +new "xpath issue ok" +expectpart "$($clixon_util_xpath -D $DBG -f $dir/1.xml -n ex:urn:example:clixon -y $fyang -p "/ex:table/options/*")" 0 "50000" + +new "xpath issue fail" +expectpart "$($clixon_util_xpath -D $DBG -f $dir/1.xml -n null:urn:ietf:params:xml:ns:netconf:base:1.0 -n ex:urn:example:clixon -y $fyang -p "/ex:table/ex:options/*")" 0 "50000" + rm -rf $dir new "endtest"