XML Bird is an XML parser for programs written in Vala or C.
Author: Johan Mattsson
License: LGPL v3
Webpage: https://birdfont.org/xmlbird.php
Install valac and Glib first.
Configure, build and install with doit:
./configure
doit
sudo ./install.py
Configure, build and install without doit:
./configure
./build.py
sudo ./install.py
The default prefix is /usr/local but you can set the prefix to /usr
./configure --prefix=/usr
Exampel usage:
using B;
// Print all tags and attributes in an XML document.
// Expected output:
// tag1
// tag2
// attribute1
public static int main (string[] arg) {
Tag root;
XmlParser parser;
parser = new XmlParser ("""<tag1><tag2 attribute1=""/></tag1>""");
if (!parser.validate ()) {
warning ("Invalid XML.");
return 1;
}
root = parser.get_root_tag ();
print_tags (root);
return 0;
}
void print_tags (Tag tag) {
print (tag.get_name ());
print ("\n");
print_attributes (tag);
foreach (Tag t in tag) {
print_tags (t);
}
}
void print_attributes (Tag tag) {
Attributes attributes = tag.get_attributes ();
foreach (Attribute attribute in attributes) {
print (attribute.get_name ());
print ("\n");
}
}
There is a test suite with benchmarks. Run “doit test”.
XML Bird is a part of the Birdfont project.