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

Mantis Bug Tracker noreply at opencsw.org
Mon May 30 19:33:58 CEST 2011


A NOTE has been added to this issue. 
====================================================================== 
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:                     feedback
====================================================================== 
Date Submitted:             2010-12-21 18:51 CET
Last Modified:              2011-05-30 19:33 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
====================================================================== 

---------------------------------------------------------------------- 
 (0009093) skayser (administrator) - 2011-05-30 19:33
 https://www.opencsw.org/mantis/view.php?id=4645#c9093 
---------------------------------------------------------------------- 
Feature has been integrated by upstream and thus should be available with
the next release.

http://sourceforge.net/tracker/?func=detail&aid=3155702&group_id=66612&atid=515109#artifact_comment_5181486



More information about the bug-notifications mailing list