Re: [Vala] GMarkup broken in Vala 0.4.0?
- From: "Matías De la Puente" <mfpuente ar gmail com>
- To: "Yu Feng" <rainwoodman gmail com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] GMarkup broken in Vala 0.4.0?
- Date: Wed, 22 Oct 2008 10:27:18 -0200
Hi Yu
I patch the glib.vapi changing Markup delegates
http://bugzilla.gnome.org/show_bug.cgi?id=553282 I done that to use "this" inside the method of the class.
With this you can access the members and function of the class that aren't static.
here is a working example compiled with vala 0.4.0
public class Test
{
void start (MarkupParseContext context, string element_name, string[] attribute_names, string[] attribute_values)
{
print ("start " + element_name + "\n");
}
void end (MarkupParseContext context, string element_name)
{
print ("end " + element_name + "\n");
}
void text (MarkupParseContext context, string text, ulong text_len)
{
print ("text " + text + "\n");
}
public Test ()
{
MarkupParser parser = {start, end, text, null, null };
MarkupParseContext context = new MarkupParseContext (parser, MarkupParseFlags.TREAT_CDATA_AS_TEXT, this, null);
string xml_file;
FileUtils.get_contents ("test.xml", out xml_file);
context.parse (xml_file, xml_file.len ());
}
public static void main (string[] args)
{
var test = new Test ();
}
}
Matias
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]