[bug-notifications] [xmlstarlet 0004645]: Return code in select mode could indicate whether query matches or not

Mantis Bug Tracker noreply at opencsw.org
Wed Jun 15 14:18:32 CEST 2011


The following issue has been CLOSED 
====================================================================== 
https://www.opencsw.org/mantis/view.php?id=4645 
====================================================================== 
Reported By:                skayser
Assigned To:                dam
====================================================================== 
Project:                    xmlstarlet
Issue ID:                   4645
Category:                   regular use
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     closed
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             2010-12-21 18:51 CET
Last Modified:              2011-06-15 14:18 CEST
====================================================================== 
Summary:                    Return code in select mode could indicate whether
query matches or not
Description: 
I am trying to use xmlstarlet to test whether XML documents contain certain
elements. Here it would be very helpful, if xmlstarlet could indicate via
its return code whether or not matching elements were found (just like e.g.
grep does). Currently, the return code is always 0 in either case.

$ cat test.xml
<test>
    <item name="foo">bar</item>
</test>

$ xmlstarlet sel -t -c "//item[@name='foo']" test.xml
<item name="foo">bar</item>
$ echo $?
0

$ xmlstarlet sel -t -c "//item[@name='foo-nomatch']" test.xml
$ echo $?
0
====================================================================== 

---------------------------------------------------------------------- 
 (0009119) dam (administrator) - 2011-06-15 14:18
 https://www.opencsw.org/mantis/view.php?id=4645#c9119 
---------------------------------------------------------------------- 
Fixed in 1.2.0,REV=2011.06.01 and released to current/.



More information about the bug-notifications mailing list