On 06.10.2015 17:57, Jay Strict wrote: > 2) I want to read and parse the XML file that Syncthing uses as its > configuration file [4]. What is the best way to do so? I found the > Simple XML Subset Parser [5] in the GLib library and I think this would > be suitable, as the config file does not look very complex. > I also found an older thread [6] about this topic, in which it was > suggested to use E4X. But E4X seems to be obsolete. > Are there better alternatives? Can Gjs do something like this? >
> [4] http://docs.syncthing.net/users/config.html > [5] > https://developer.gnome.org/glib/stable/glib-Simple-XML-Subset-Parser.html > [6] > https://mail.gnome.org/archives/gnome-shell-list/2012-November/msg00021.html > I want to use the Simple XML Subset Parser from GLib and have the following source code lines in extension.js (in addition to the functions init() and enable()). ====================================================================== const GLib = imports.gi.GLib; const XMLConfigParser = new Lang.Class({ Name: 'XMLConfigParser', Extends: GLib.MarkupParser, // _construct : function() { // }, start_element : function(context, element_name, attribute_names, attribute_values, user_data) { log ('context: ' + context); }, }); let _xmlConfigParser = new XMLConfigParser(); let parseContext = new GLib.MarkupParseContext(_xmlConfigParser, 0, null); parseContext.parse("Test", 4); ====================================================================== But when trying to load the extension, I get the error message ====================================================================== TypeError: this._construct is undefined ====================================================================== If I add a new empty method "_construct", the error message is ====================================================================== TypeError: Object 0x7fef55023340 is not a subclass of GObject_Boxed, it's a Object ====================================================================== Does anybody have a hint for me, what I am doing wrong? Thanks Jay _______________________________________________ gnome-shell-list mailing list gnome-shell-list@gnome.org https://mail.gnome.org/mailman/listinfo/gnome-shell-list