Skip to content

Instantly share code, notes, and snippets.

@garethrees
Created September 19, 2017 16:47
Show Gist options
  • Select an option

  • Save garethrees/601627e842cea90152ab59b09d089480 to your computer and use it in GitHub Desktop.

Select an option

Save garethrees/601627e842cea90152ab59b09d089480 to your computer and use it in GitHub Desktop.
Validate an atom feed from the command line
# Save the Atom RELAX NG Compact Schema locally
# https://xml2rfc.tools.ietf.org/public/rfc/html/rfc4287.html#schema
# Just pasted in to `atom.rnc`
# Save the feed output locally
wget -O request_events.atom "https://www.whatdotheyknow.com/api/v2/body/71/request_events.atom?k=REDACTED&since_date=2017-09-15"
# Install a tool to convert comtact syntax to XML syntax
# Via https://stackoverflow.com/a/45979608/387558
brew install jing-trang
# Convert the compact syntax to XML syntax
$ trang -I rnc -O rng atom.rnc atom.rng
# Validate the feed
$ xmllint --noout --relaxng atom.rng request_events.atom
request_events.atom validates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment