Re: Code for placing a XML dock in a GtkTree?



I totally agree with Greg on this,

Expat is a great piece of software, arguably the fastest XML parser on Earth, low memory usage, very elegant, so important in current days that Linux distros as Fedora and Suse store Expat on /lib instead of /usr/lib (with symlinks from /usr/lib), so it can be used even when /usr/lib is not mounted...

Expat comes with a good manual, several examples, and the people on the (low-traffic) mailling list is very knowleadgeble and willing to help newbies...

In my case, I use Expat to load object and config XML data (plus XHTML doc files...) to my memory engine. The object data hierarchy in turn can be seen with GtkTreeView widgets, as you want.

Of course don't expect to be a Expat expert in 24 hours, but you will not regret going with Expat.

Carlos
G Hasse wrote:
| Hello,
|
| To place an XML document in a GtkTree must be a fairly common
| stuff to do. Can anyone point me to some examples or code I would
| be happy.
|

Basically you use something like an XML_Parser (from http://www.libexpat.org/), you're distro may have the "expat" package, well, you'll need expat-devel, and #include <expat.h>)

XML_Parser is setup with callback routines that are passed the xml tag, and associated data.

The XML_Parser object is then used to parse the xml blob, and it will call callback
routines at each xml level.

The callback routine then decides what to do with the tag (and associated date). It might, for example, create a new row in the GtkTree, or it might create a new node, or it might
ignore the data altogether.


| Greg Hosler                    ghosler redhat com    |





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]