Skip to content

Instantly share code, notes, and snippets.

@karronoli
Created February 11, 2016 08:36
Show Gist options
  • Save karronoli/1a7fa58b25fa56694dd2 to your computer and use it in GitHub Desktop.
Save karronoli/1a7fa58b25fa56694dd2 to your computer and use it in GitHub Desktop.
XPath runner
// Written in the D programming language
import std.stdio;
import std.file;
import kxml.xml;
void main(string[] argv)
{
if (argv.length != 3)
throw new Exception("bad argument. 1st: path, 2nd: xpath");
auto path = argv[1], xpath = argv[2];
auto xml = readDocument(readText(path));
foreach (v; xml.parseXPath(xpath))
writeln(v);
}
{
"name": "xpath-runner",
"description": "XPath runner",
"copyright": "Copyright © 2016, karronoli",
"authors": ["karronoli"],
"targetType": "executable",
"dflags": ["-allinst"],
"dependencies": {
"kxml": ">=1.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment