Re: [gdome]XPATH workaround



Hi.

T.J. Mather is working on the XPATH module right now. Unfortunately, I
still had no time to look at his code, but hopefully it'll be available
shortly.

We're not going to release Gdome2 with workaround APIs, especially because
the XPATH module might be available in the near future.

In the meantime, there are some things you can try to do.

Your problem is to go back and forth between libxml2 nodes and Gdome2
nodes. There are some dirty tricks to do this:

a) Gdome2 => libxml2
   you can have a look at the definition of Gdome structures, then you can
   redefine the structure in your own code and do a raw cast from a
   GdomeNode* to a pointer to your structure. In this way you can access
   the field n, which is the pointer to the underlying libxml2 node. If
   I'm right, this pointer is always found at the same offset, but don't
   guarantee.

b) libxml2 =2 Gdome2
   This way is more difficult, because it can possibly involve the
   allocation of a Gdome structure. However, examine the field _private of
   the libxml2 node. If it's not NULL, then it's a pointer to a Gdome
   wrapper, so you can cast it and doing a _ref on it if you store it
   somewhere. If this field is NULL (likely) you can try to do a manual
   allocation in the following way:
   have a look at gdome-xml-node.c, there is a function taking a
   xmlNode* and allocating the Gdome wrapper. This function is not
   static, so if you declare a prototype for it you'll be able to
   call it from your source code.

Other ways might be possible, but don't recall them right now.

Regards,

	luca





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