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



On Tue, Jun 10, 2008 at 04:33:33PM +0100, Carlos Pereira wrote:
I totally agree with Greg on this,

Tanks for all your advice. I ended up in using libxml2 and
I have made me some sample programs. It works quite nice.
I do like xpath things in libxml2. And I realy like the
tree-widget in Gtk. Now I can edit elements directly onscreen.
This is great for a customer application I am developing.

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    |


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

-- 
Göran Hasse

----------------------------------------------------------------
Göran Hasse           email: gorhas raditex se  Tel: 019-450105
Raditex AB             http://www.raditex.se    
Planiavägen 15, 1tr                             Mob: 070-5530148
131 34  NACKA, SWEDEN                         OrgNr: 556240-0589
VAT: SE556240058901
------------------------------------------------------------------




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