[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [Vala] GMarkup broken in Vala 0.4.0?
- From: Yu Feng <rainwoodman gmail com>
- To: Matías De la Puente <mfpuente ar gmail com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] GMarkup broken in Vala 0.4.0?
- Date: Wed, 29 Oct 2008 18:44:11 -0400
Hi Matias,
It doesn't work if Test is a subclass of Object.
Yu
On Wed, 2008-10-22 at 10:27 -0200, Matías De la Puente wrote:
> 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]