using GLib; class Foo { MarkupParser parser; public Foo() { parser.start_element = startElement; parser.end_element = endElement; parser.text = textFunc; parser.passthrough = passthroughFunc; parser.error = errorFunc; } public void startElement(MarkupParseContext context, string element_name, string[] attribute_names, string[] attribute_values) throws MarkupError { debug( @"start element $element_name" ); } public void endElement(MarkupParseContext context, string element_name) throws MarkupError { debug( @"end element $element_name" ); } public void textFunc(MarkupParseContext context, string text, size_t text_len) throws MarkupError { debug( @"text '$text'" ); } public void passthroughFunc(MarkupParseContext context, string passthrough_text, size_t text_len) throws MarkupError { debug( @"passthrough" ); } public void errorFunc (MarkupParseContext context, Error error) { debug( @"error: $(error.message)" ); } } void main() { }