XML Bird

XML parser written in Vala

Development

Git repository: github.

Example usage:

valac --pkg xmlbird example.vala -o example

example.vala:

using B; // Expected output: // hello // world public static int main (string[] arg) { Tag root; XmlParser parser; string xml; xml = """<test><region greeting="hello">world</region></test>"""; parser = new XmlParser (xml); if (!parser.validate ()) { warning ("Invalid XML."); return 1; } root = parser.get_root_tag (); print_message (root); return 0; } void print_message (Tag tag) { foreach (Tag t in tag) { if (t.get_name () == "region") { print_greeting_attribute (t); print (t.get_content ()); print ("\n"); } } } void print_greeting_attribute (Tag tag) { Attributes attributes = tag.get_attributes (); foreach (Attribute attribute in attributes) { if (attribute.get_name () == "greeting") { print (attribute.get_content ()); print ("\n"); } } }

Birdfont

XML Bird was developed as a part of the Birdfont project.