dyaml/examples/getting_started/main.d

19 lines
405 B
D
Raw Normal View History

2011-08-16 12:53:13 +00:00
import std.stdio;
import dyaml;
2011-08-16 12:53:13 +00:00
void main()
{
//Read the input.
Node root = Loader.fromFile("input.yaml").load();
//Display the data read.
2011-08-16 12:53:13 +00:00
foreach(string word; root["Hello World"])
{
writeln(word);
}
writeln("The answer is ", root["Answer"].as!int);
//Dump the loaded document to output.yaml.
dumper(File("output.yaml", "w").lockingTextWriter).dump(root);
2011-08-16 12:53:13 +00:00
}