1 namespace WebProvisioning
5 public void text_element_func (MarkupParseContext context,
7 size_t text_len) throws MarkupError
9 unowned SList<string> stack = context.get_element_stack ();
11 if (stack.nth_data(0) == "display-name")
19 class WebProvisionParser
21 public WebProvisionParser (string path)
24 var file = File.new_for_path (path);
28 var dis = new DataInputStream (file.read ());
30 while ((line = dis.read_line (null)) != null)
35 error ("Could not retreive file size");
38 MarkupParser parser = {null, null, text_element_func, null, null};
40 var ctx = new MarkupParseContext(parser, 0, null, null);
44 ctx.parse (text, text.length);
48 error ("Could not parse %s, invalid content", path);
53 public static int main (string[] args)
57 error ("Usage %s [-a] WEB_PROVISIONING_FILE", args[0]);
60 if (!FileUtils.test (args[1], FileTest.EXISTS | FileTest.IS_REGULAR))
62 error ("%s does not exist", args[1]);
65 var webp = new WebProvisionParser (args[1]);