Re: [gdome]Gdome and External node data?



Hi John,

> nodes.  I was wondering if Gdome allows for either arbitrary data to be
> attached to nodes

yes, this is possible. There is a field "user_data" associated to each
node which is usually used to store a pointer to another data structure
(layering). It is an oversimplified version of the "user data" capability
in DOM level 3 (still to become recommendation)

> or the ability to subclass Gdome nodes to include new
> functionality while still being able to "look" like a Gdome tree to the
> Gdome interfaces? 

you are referring to the inheritance vs. layering extension
mechanism. Inheritance is not supported by the C implementation, not now
at least. But it might be the case that some bindings for other languages
(Ruby? Perl?) allow this. The bindings I've been working on are for C++
and Ocaml. For C++ it would be possible to create an architecture allowing
inheritance of interfaces, but I haven't implemented it yet (see
http://gmetadom.sourceforge.net for details)

> multiple tags or attributes into one attribute.  To access the simple
> attributes as text would be both slow and require parsing of the
> attributes every time a point needed to be changed.

This is true. It is also true, however, that in many cases when you modify
attributes you are doing editing, and that the speed you edit the document
is millions of time slower that the speed of parsing attributes.

Another point of view could be the following: DOM defines
*interfaces*. You can design your own classes to optimize for speed,
internal representation etc., and you also *expose* a DOM interface which
makes your structure look like an XML tree. But then you're on your own,
and you can't use Gdome any more (because Gdome does have its own
representation of the document).

An alternative approach is to have a Gdome layer, and another layer which
is optimized for your tasks. Then the issue is how to keep synchronized
the two layers, and here DOM events might play an important role.

> My other question is can Gdome's scripting bindings be passed a Gdome
> tree from C, manipulate it and return the results back? 

I can answer "yes" for my bindings (Ocaml and C++). In that case I access
the same tree at the same time from two different languages.

Hope that was useful,
luca





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