using Xml; class xml_parser { public void parse_file (string path) { Xml.Doc *file = Parser.parse_file (path); if (file == null) { stderr.printf ("Cannot open file"); return; } Xml.Node *root = file->get_root_element (); if (root == null) { delete file; stderr.printf ("Xml file '%s' is empty", path); return; } stdout.printf ("Root node '%s'", root->name); } } int main (string[] args) { if (args.length < 2) { stderr.printf ("Argument required!\n"); return 1; } // Initialisation, not instantiation since the parser is a static class Parser.init (); var sample = new xml_parser (); // Parse the file listed in the first passed argument sample.parse_file (args[1]); // Do the parser cleanup to free the used memory Parser.cleanup (); return 0; }