我现在正在努力完成以下任务。我正在尝试使用XMLStarlet删除空的XML条目。
我尝试使用的是这个XPATH:
//*[not(./*) and (not(./text()) or normalize-space(./text())='')]我已经在http://www.freeformatter.com/xpath-tester.html上测试过了,它和预期的一样工作。与XMLStarlet配合不起作用:
xmlstarlet ed -d '//*[not(./*) and (not(./text()) or normalize-space(./text())='')]'这是什么原因呢?
发布于 2016-05-27 03:29:55
尽量使用双引号,反之亦然。
对于您的示例:
xmlstarlet ed -d '//*[not(./*) and (not(./text()) or normalize-space(./text())="")]'或
xmlstarlet ed -d "//*[not(./*) and (not(./text()) or normalize-space(./text())='')]"https://stackoverflow.com/questions/37463898
复制相似问题