GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

regarding xml in gtk

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
cnu_sree
GTK+ Geek


Joined: 06 Oct 2006
Posts: 57

PostPosted: Fri Apr 20, 2007 7:26 am    Post subject: regarding xml in gtk Reply with quote

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
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 376
Location: State College, Pennsylvania

PostPosted: Fri Apr 20, 2007 1:42 pm    Post subject: Reply with quote

GLib has a simple XML api, which can be found at http://developer.gnome.org/doc/API/2.0/glib/glib-Simple-XML-Subset-Parser.html
Back to top
cnu_sree
GTK+ Geek


Joined: 06 Oct 2006
Posts: 57

PostPosted: Wed Apr 25, 2007 8:39 am    Post subject: Reply with quote

thank u
but is there any example on this.
i con't understand the API
thank u
sree
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 376
Location: State College, Pennsylvania

PostPosted: Wed Apr 25, 2007 1:08 pm    Post subject: Reply with quote

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.
Back to top
cnu_sree
GTK+ Geek


Joined: 06 Oct 2006
Posts: 57

PostPosted: Sat Apr 28, 2007 12:10 pm    Post subject: Reply with quote

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
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 376
Location: State College, Pennsylvania

PostPosted: Sat Apr 28, 2007 2:16 pm    Post subject: Reply with quote

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.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP