Re: [gdome] Creating a Document in Fragments



On Sun, 2004-06-06 at 18:40, John J. Boyer wrote:
> If I use libxml2 to construct a parse tree of the document, Is there  way 
> to convert it to a GDOME2 tree?

no conversion is needed because gdome2 is just a wrapper around libxml2.
However, the function that creates a wrapper for a libxml2 document is
not exposed in the public gdome2 API. So, if you really want to go this
way, you need

a) to expose the hidden gdome2 method that serves your purpose, I
presume in your case it is gdome_xml_doc_mkref. So in your source code
you have to declare it as:

extern GdomeDocument* gdome_xml_doc_mkref (xmlDoc*);

b) to load the XML document with whatever libxml2 API you need. Let's
say you end up with a xmlDoc* d variable.

c) to get the Gdome2 wrapper:

  GdomeDocument* doc = gdome_xml_doc_mkref(d);

Needless to say, this is not the way gdome2 has been designed to be
used, but it should work flawlessly. At least, it works nicely in the
other direction (from a gdome2 wrapper obtaining the underlying libxml2
structure), and to my knowledge there is no reason why it should fail
the other way around.

HTH,
--luca

Attachment: signature.asc
Description: This is a digitally signed message part



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