[libxml++] Design Issue (was: libxml++ on win32 domparser problem)



Thanks Stefan,

Now the problem is clear - DomParser does not reference Document in any way,
so that Document  with its static initialization object does not get linked
in if you only use
DomParser.
As I see it, this is a correct behavior of the linker. (why doesn't this
happen on other platforms?)

Which brings me to the design issue:
DomParser and Document contain duplicate document access functions
which are implemented twice (some even with different names - set_root /
create_root).

My suggestion is:
Leave document access functions only in Document.
DomParser will hold an internal Document instead of having only an xmlDoc.
Add a get_document function to DomParser to access the Document.

This is cleaner, without duplication, and solves the initialization problem.


Regards,
-eff


----- Original Message -----
From: "Stefan Seefeld" <seefeld sympatico ca>
To: <libxmlplusplus-general lists sourceforge net>
Sent: Wednesday, March 05, 2003 4:18 AM
Subject: Re: [libxml++] libxml++ on win32 domparser problem


> Ephraim Vider wrote:
> > Hi,
> >
> > I successfully compiled xml++ (0.20) on windows using msvc 6 and the pre
> > built
> > version of libxml2 2.5.1 for windows.
> > the basics seem to work, but I am truly baffled with domparser..
> >
> > The example in dom_parser crashes because parser.get_root_node() returns
0.
> > Actually I am not surprised that this happens because I can't figure out
> > how and when the _private
> > member should have been initialized to point to an Element.
> >
> > Can someone explain how this code is supposed to work?
>
> libxml++ is a wrapper around libxml2. The latter provides a callback
> mechanism to notify the wrapper whenever a xmlNode is created/destroyed.
> In document.cc a function 'construct' is registered with libxml2 that is
> responsible to allocate wrapper objects, pointed to by the various
_private
> members.
>
> Please test whether the Document::Init constructor is actually called, as
> this is the place where the callbacks are initialized. It seems that isn't
> working right for you. May be this is a bug in msvc 6 not initializing the
> Document::_init object...
>
> Regards,
> Stefan
>





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