Skip to content

Instantly share code, notes, and snippets.

@lstroud
Created May 9, 2014 20:37
Show Gist options
  • Save lstroud/4703bad44c01c0c9a3da to your computer and use it in GitHub Desktop.
Save lstroud/4703bad44c01c0c9a3da to your computer and use it in GitHub Desktop.
xml xpath selector one-liners
curl -u aname "http://someserver/deploylist.xml" | xmllint --xpath '//deploy-name/text()' -
curl -u aname "http://someserver/deploylist.xml" | ruby -r nokogiri -e 'd=Nokogiri::XML($stdin); puts d.xpath("//deploy-name/text()")'
curl -u aname "http://someserver/deploylist.xml" | node -e "var i=process.stdin; i.resume(); i.on('data', function(d) { require('xpath').select('//deploy-name/text()', (new (require('xmldom')).DOMParser()).parseFromString(d.toString())).forEach(function(n){console.log(n.textContent);}); });"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment