Fixed: [Xpath API do not support filter data by wildcard](https://github.com/clicon/clixon/issues/313)
This commit is contained in:
parent
159ac0a2d7
commit
a973eaaeef
4 changed files with 38 additions and 0 deletions
|
|
@ -39,6 +39,7 @@ Expected: May 2022
|
||||||
|
|
||||||
### Corrected Bugs
|
### Corrected Bugs
|
||||||
|
|
||||||
|
* Fixed: [Xpath API do not support filter data by wildcard](https://github.com/clicon/clixon/issues/313)
|
||||||
* Fixed: SEGV in cli show yang
|
* Fixed: SEGV in cli show yang
|
||||||
|
|
||||||
## 5.6.0
|
## 5.6.0
|
||||||
|
|
|
||||||
|
|
@ -962,6 +962,9 @@ traverse_canonical(xpath_tree *xs,
|
||||||
|
|
||||||
switch (xs->xs_type){
|
switch (xs->xs_type){
|
||||||
case XP_NODE: /* s0 is namespace prefix, s1 is name */
|
case XP_NODE: /* s0 is namespace prefix, s1 is name */
|
||||||
|
/* Nodetest = * needs no prefix */
|
||||||
|
if (xs->xs_s1 && strcmp(xs->xs_s1, "*") == 0)
|
||||||
|
break;
|
||||||
prefix0 = xs->xs_s0;
|
prefix0 = xs->xs_s0;
|
||||||
if ((namespace = xml_nsctx_get(nsc0, prefix0)) == NULL){
|
if ((namespace = xml_nsctx_get(nsc0, prefix0)) == NULL){
|
||||||
if ((cb = cbuf_new()) == NULL){
|
if ((cb = cbuf_new()) == NULL){
|
||||||
|
|
|
||||||
|
|
@ -134,3 +134,7 @@ If you do not have them, generate self-signed certs, eg as follows:
|
||||||
```
|
```
|
||||||
|
|
||||||
There are also client-cert tests, eg `test_ssl_certs.sh`
|
There are also client-cert tests, eg `test_ssl_certs.sh`
|
||||||
|
|
||||||
|
## Known issues
|
||||||
|
|
||||||
|
[Workaround: Unicode double-quote in iana-if-type@2022-03-07.yang](https://github.com/clicon/clixon/issues/315)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
||||||
xml=$dir/xml.xml
|
xml=$dir/xml.xml
|
||||||
xml2=$dir/xml2.xml
|
xml2=$dir/xml2.xml
|
||||||
xml3=$dir/xml3.xml
|
xml3=$dir/xml3.xml
|
||||||
|
xml4=$dir/xml4.xml
|
||||||
|
|
||||||
cat <<EOF > $xml
|
cat <<EOF > $xml
|
||||||
<aaa>
|
<aaa>
|
||||||
|
|
@ -75,6 +76,26 @@ cat <<EOF > $xml3
|
||||||
</bbb>
|
</bbb>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Asterisk
|
||||||
|
cat <<EOF > $xml4
|
||||||
|
<root>
|
||||||
|
<x>
|
||||||
|
<a>111</a>
|
||||||
|
</x>
|
||||||
|
<y>
|
||||||
|
<a>222</a>
|
||||||
|
</y>
|
||||||
|
<z>
|
||||||
|
<b>111</b>
|
||||||
|
</z>
|
||||||
|
<w>
|
||||||
|
<a>111</a>
|
||||||
|
</w>
|
||||||
|
</root>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
new "xpath /"
|
new "xpath /"
|
||||||
expecteof "$clixon_util_xpath -f $xml -p /" 0 "" "^nodeset:0:<aaa><bbb x=\"hello\"><ccc>42</ccc></bbb><bbb x=\"bye\"><ccc>99</ccc></bbb><ddd><ccc>22</ccc></ddd></aaa>$"
|
expecteof "$clixon_util_xpath -f $xml -p /" 0 "" "^nodeset:0:<aaa><bbb x=\"hello\"><ccc>42</ccc></bbb><bbb x=\"bye\"><ccc>99</ccc></bbb><ddd><ccc>22</ccc></ddd></aaa>$"
|
||||||
|
|
||||||
|
|
@ -234,6 +255,15 @@ expectpart "$($clixon_util_xpath -f $xml3 -l o -p "dontexist()")" 255 "Unknown x
|
||||||
new "xpath enum-value nyi"
|
new "xpath enum-value nyi"
|
||||||
expectpart "$($clixon_util_xpath -f $xml3 -l o -p "enum-value()")" 255 "XPATH function \"enum-value\" is not implemented"
|
expectpart "$($clixon_util_xpath -f $xml3 -l o -p "enum-value()")" 255 "XPATH function \"enum-value\" is not implemented"
|
||||||
|
|
||||||
|
new "xpath /root/*/a"
|
||||||
|
expecteof "$clixon_util_xpath -f $xml4 -p /root/*/a" 0 "" "nodeset:0:<a>111</a>1:<a>222</a>2:<a>111</a>"
|
||||||
|
|
||||||
|
new "xpath /root/*/b"
|
||||||
|
expecteof "$clixon_util_xpath -f $xml4 -p /root/*/b" 0 "" "nodeset:0:<b>111</b>"
|
||||||
|
|
||||||
|
new "xpath /root/*/*[.='111']"
|
||||||
|
expecteof "$clixon_util_xpath -f $xml4 -p /root/*/*[.='111']" 0 "" "nodeset:0:<a>111</a>1:<b>111</b>2:<a>111</a>"
|
||||||
|
|
||||||
rm -rf $dir
|
rm -rf $dir
|
||||||
|
|
||||||
# unset conditional parameters
|
# unset conditional parameters
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue