<i>"You wonder why it hasn't been done before," one said.</i><p>To cite some previous work:<p>sgrep (structured grep): <a href="http://www.cs.helsinki.fi/u/jjaakkol/sgrep.html" rel="nofollow">http://www.cs.helsinki.fi/u/jjaakkol/sgrep.html</a><p>xmlstarlet (including xpath): <a href="http://xmlstar.sourceforge.net/" rel="nofollow">http://xmlstar.sourceforge.net/</a><p>xmldiff: <a href="http://www.logilab.org/859" rel="nofollow">http://www.logilab.org/859</a><p>jsawk (including jsonquery): <a href="https://github.com/micha/jsawk" rel="nofollow">https://github.com/micha/jsawk</a>