After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 773428 - Port Examples to latest API
Port Examples to latest API
Status: RESOLVED FIXED
Product: gxml
Classification: Other
Component: general
0.14.x
Other Linux
: Normal enhancement
: ---
Assigned To: GXml maintainer(s)
GXml maintainer(s)
: 702668 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-10-24 15:27 UTC by adria.arrufat
Modified: 2017-09-06 23:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Error log when trying to build the provided example.vala (4.35 KB, text/plain)
2016-10-24 15:27 UTC, adria.arrufat
Details

Description adria.arrufat 2016-10-24 15:27:31 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
Comment 1 Daniel Espinosa 2016-10-25 03:56:13 UTC
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.
Comment 2 adria.arrufat 2016-10-25 06:36:40 UTC
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 ();`
Comment 3 Daniel Espinosa 2016-10-25 11:26:35 UTC
I need to update that examples to latest API.
Comment 4 Daniel Espinosa 2016-10-26 19:59:24 UTC
I've changed this bug's title to follow up required changes in examples.

Feel free to add any comment about them.
Comment 5 Daniel Espinosa 2017-03-17 14:00:11 UTC
*** Bug 702668 has been marked as a duplicate of this bug. ***
Comment 6 Daniel Espinosa 2017-09-06 23:19:58 UTC
This has been fixed at:

https://git.gnome.org/browse/gxml/commit/?id=50391684330e72ae312786f527c59bbf2a7f66c8