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:51:52 -0400
On Wed, 2008-10-22 at 12:05 -0200, Matías De la Puente wrote:
Thanks for the clarifying! But I am still curious why my code didn't
work.
class MyClass {
public static MarkupParser p;
void somefunction() {
p.start_element = start_element;
}
void start_element(
MarkupParseContext context, string element_name,
string[] attribute_names, string[] attribute_values) {
//do stuff
}
}
Could you confirm my problem?
Can you send me a testcase with the results?
matias
I found it.
public class Test
{
void start (MarkupParseContext context, string element_name,
string[]
attribute_names, string[] attribute_values) throws GLib.Error
{
print ("start " + element_name + "\n");
}
void end (MarkupParseContext context, string element_name) throws
GLib.Error
{
print ("end " + element_name + "\n");
}
void text (MarkupParseContext context, string text, ulong text_len)
throws GLib.Error
{
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 ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]