没有找到包含 > 的 XMLStarlet 的标记
No finding tag with XMLStarlet that contains >
我在 bash 脚本中使用 XMLStarlet 来基本上根据文件中 git 的更改找到特定的 XML 节点。
这工作正常,直到我们找到一个需要搜索的节点,该节点包含 >
作为其值的一部分。
我要查找的节点示例:
<?xml version="1.0" encoding="UTF-8"?>
<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata">
<labels>
<fullName>Button_Value_Get_Data</fullName>
<categories>Button Value</categories>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Value for Button to get Data</shortDescription>
<value>> GET VEHICLE DATA</value>
</labels>
</CustomLabels>
这是我的命令 运行:
xmlstarlet sel -N x="http://soap.sforce.com/2006/04/metadata" -t -c "//x:labels[x:value/text()=\"> GET VEHICLE DATA\"]/x:fullName" -n myFile.xml
当需要搜索的值不包含 >
时,同样的命令效果很好。
有没有办法搜索这个?或者这是一个 xmlstarlet 限制?
谢谢。
>
是>
的编码。如果您在表达式中使用文字值,它会正确匹配:
$ xmlstarlet sel -N x="http://soap.sforce.com/2006/04/metadata" -t -c "//x:labels[x:value/text()=\"> GET VEHICLE DATA\"]/x:fullName" -n test.xml
<fullName xmlns="http://soap.sforce.com/2006/04/metadata">Button_Value_Get_Data</fullName>
我在 bash 脚本中使用 XMLStarlet 来基本上根据文件中 git 的更改找到特定的 XML 节点。
这工作正常,直到我们找到一个需要搜索的节点,该节点包含 >
作为其值的一部分。
我要查找的节点示例:
<?xml version="1.0" encoding="UTF-8"?>
<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata">
<labels>
<fullName>Button_Value_Get_Data</fullName>
<categories>Button Value</categories>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Value for Button to get Data</shortDescription>
<value>> GET VEHICLE DATA</value>
</labels>
</CustomLabels>
这是我的命令 运行:
xmlstarlet sel -N x="http://soap.sforce.com/2006/04/metadata" -t -c "//x:labels[x:value/text()=\"> GET VEHICLE DATA\"]/x:fullName" -n myFile.xml
当需要搜索的值不包含 >
时,同样的命令效果很好。
有没有办法搜索这个?或者这是一个 xmlstarlet 限制?
谢谢。
>
是>
的编码。如果您在表达式中使用文字值,它会正确匹配:
$ xmlstarlet sel -N x="http://soap.sforce.com/2006/04/metadata" -t -c "//x:labels[x:value/text()=\"> GET VEHICLE DATA\"]/x:fullName" -n test.xml
<fullName xmlns="http://soap.sforce.com/2006/04/metadata">Button_Value_Get_Data</fullName>