|
|
| Author |
Message |
|
|
cnu_sree GTK+ Geek
Joined: 06 Oct 2006 Posts: 57
|
Posted: Fri Apr 20, 2007 7:26 am Post subject: regarding xml in gtk |
|
|
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
|
|
| Back to top |
|
 |
cnu_sree GTK+ Geek
Joined: 06 Oct 2006 Posts: 57
|
Posted: Wed Apr 25, 2007 8:39 am Post subject: |
|
|
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
|
Posted: Wed Apr 25, 2007 1:08 pm Post subject: |
|
|
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
|
Posted: Sat Apr 28, 2007 12:10 pm Post subject: |
|
|
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
|
Posted: Sat Apr 28, 2007 2:16 pm Post subject: |
|
|
| 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 |
|
 |
|