How to ignore empty selections in XmlStarlet?
I have a script that performs many XML edit operations with xmlstarlet.
For instance, it remove all 'foo nodes if any are present:
xmlstarlet ed -d '//foo'
(except that in my script, the name of the element is not foo).
When no foo node is present, the following message is printed:
None of the XPaths matched; to match a node in the default namespace
use '_' as the prefix (see section 5.1 in the manual).
For instance, use /_:node instead of /node
I do not want to disable such warnings, but for this particular operation,
I do want to get this particular warning, as I am quite aware that no foo
nodes may be present.
How can I achieve this?
No comments:
Post a Comment