Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
923 views
in Technique[技术] by (71.8m points)

xmllint unknown option '--xpath'

I've seen this syntax several places (eg, here):

xmllint --xpath '/plist/array/string/text()' tmp.xml, used to query a particular XML node using an xpath selector. However, I'm getting the error Unknown option --xpath when I try to execute this on my machine (mac os x snow leopard).

Looking more closely at the man page for xmllint, I don't see the --xpath option documented...

Am I just totally missing something here?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
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()'

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...