GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Dec 18, 2014 7:32 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: regarding xml in gtk
PostPosted: Fri Apr 20, 2007 7:26 am 
Offline
GTK+ Geek

Joined: Fri Oct 06, 2006 6:37 am
Posts: 57
is it possibel to read , write and parsing of xml in gtk+c.
is there any predefined class for xml
is there any tutorial or examples please provide me
thank u
sree


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 20, 2007 1:42 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
GLib has a simple XML api, which can be found at http://developer.gnome.org/doc/API/2.0/ ... arser.html

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 8:39 am 
Offline
GTK+ Geek

Joined: Fri Oct 06, 2006 6:37 am
Posts: 57
thank u
but is there any example on this.
i con't understand the API
thank u
sree


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 1:08 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
There aren't any tutorials that I could find on the internet. I covered the XML parser in my book for the calendar application in the last chapter, however.

As a simple overview. Basically, you populate the structure of functions. Then, you call the parsing function. The file is parsed top-down, which calls one of the six functions every time a new element is opened/closed, an error occurs, data is retrieved, or a comment is hit.

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 28, 2007 12:10 pm 
Offline
GTK+ Geek

Joined: Fri Oct 06, 2006 6:37 am
Posts: 57
thank u.
<root>
<sree>
<cnu value="gtk programming"/>
</sree>
</root>
this is my xml file
how can i retrive the value of "cnu".
i searched for tuttorial i didn't find any
so plaest tell how can i read the value and change the value of element in"cnu".
thank u
sree


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 28, 2007 2:16 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
Create a new GMarkupParser function, defining start_element(). Check element_name in that function until "cnu". Then, use the attribute value. You use g_markup_parse_context_new() to create a new GMarkupParseContext. Then, calling g_markup_parse_context_parse() will walk through the whole XML file, calling functions in your GMarkupParser for every element.

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group