xmllint unknown option '--xpath'

↘锁芯ラ 提交于 2019-11-28 10:45:39
xmllint --shell tmp.xml <<<'xpath /plist/array/string/text()'

If you need to make xmllint to read stdin:

cat /tmp/tmp.xml | xmllint --shell <(cat) <<<'xpath /plist/array/string/text()'

For some people updating is not an option. You have to work with the given version, that is installed by some other team and you go with it.

You can try through --shell:

xmllint --shell tmp.xml << EOF
'/plist/array/string/text()'
EOF

Ah, yep, must've been an issue with an outdated version of libxml2.

Updating libxml2 (to v2.7.8) via macports seems to have fixed the problem.

If you want to manipulate plist files from the command line on a Mac, use PlistBuddy.

For example, you can do this kind of thing in a shell script:

BUNDLE_ID=`/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' Info.plist`
echo $BUNDLE_ID

It's very powerful, you can add/delete items in arrays and dictionaries, look up keyed or indexed values, copy/merge/import other files, etc. See /usr/libexec/PlistBuddy -h for full info.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!