Stripping XML

xmlstarlet ed -N d="http://www.w3.org/2005/Atom" -N c="urn:oasis:names:tc:emergency:cap:1.2" -d "d:feed/d:entry/d:content/c:alert/c:info/c:area/c:polygon" fmi-alerts.xml > fmi-stripped.xml

I tried to make sense of a very, very large XML file with repeating elements of hundreds and hundreds of GPS coordinates, among other elements.

Luckily I found xmlstarlet. Installation was easy with homebrew. I just specified the namespaces and the elements to remove. The original 20Mb XML file was stripped to mere 140kb. Much easier to read!