gpt4 book ai didi

xpath - XPATH和XMLStarlet

转载 作者:行者123 更新时间:2023-12-03 17:29:54 24 4
gpt4 key购买 nike

我现在正在努力完成以下任务。我正在尝试使用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())='')]'


这可能是什么原因?

最佳答案

尝试在双引号中使用引号,反之亦然。

例如:



xmlstarlet ed -d '//*[not(./*) and (not(./text()) or normalize-space(./text())="")]'


要么

xmlstarlet ed -d "//*[not(./*) and (not(./text()) or normalize-space(./text())='')]"

关于xpath - XPATH和XMLStarlet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37463898/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com