GNOME Bugzilla – Bug 773428
Port Examples to latest API
Last modified: 2017-09-06 23:19:58 UTC
Created attachment 338359 [details] Error log when trying to build the provided example.vala Hi! I'd like to parse and create some XML documents in Vala using GXml. However, I get this error when I try the following line: ``` error: `GXml.Document' is not a class, struct, or error code Document doc = new Document (); ``` So I tried to build the example.vala provided in the source of gxml-0.12 and I am attaching the errors I found. I am compiling with vala 0.34.2: `valac --pkg gxml-0.12 example.vala` BTW, I am able to parse XML files with libxml. Thanks in advance. Adrià Arrufat
I can't find your example.vala, sorry, but the main problem is that you should use a class not an interface to create XML documents. This is: Create a GDocument or a TDocument, to start on. First one uses libxml2 as data structure, second use pure GObject classes. Then you should use: var d = new GDocument (); Then you can use two different but compatible API, one is the properties and methods in interface Document or DomDocument. If you want to know what kind of methods and properties are available, see at: http://www.valadate.org:8000/#!api=gxml-0.10/GXml But I recommend you should enable documentation in your PC and use DevHelp to see a formatted and updated documentation for GXml-0.12, using: ./configure --prefix=????? --enable-docs Feel free to file more bugs to request features or documentation.
Thank you for the quick answer, I'll try that later on. You can find the example I was referring to in gxml-0.12.0.tar.xz by decompressing it: gxml-0.12.0.tar.xz/gxml-0.12.0/examples/vala/example.vala That is what I used to get started with gxml and it is using the line I mentioned above: `Document doc = new Document ();`
I need to update that examples to latest API.
I've changed this bug's title to follow up required changes in examples. Feel free to add any comment about them.
*** Bug 702668 has been marked as a duplicate of this bug. ***
This has been fixed at: https://git.gnome.org/browse/gxml/commit/?id=50391684330e72ae312786f527c59bbf2a7f66c8