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

Mantis Bug Tracker noreply at opencsw.org
Tue Jan 11 17:02:31 CET 2011


The following issue has been ASSIGNED. 
====================================================================== 
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:                     assigned
====================================================================== 
Date Submitted:             2010-12-21 18:51 CET
Last Modified:              2011-01-11 17:02 CET
====================================================================== 
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
======================================================================



More information about the bug-notifications mailing list