You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Tinny Ng <tn...@ca.ibm.com> on 2002/05/03 22:06:19 UTC
Re: Call for Vote: which one to be the Xerces-C++ public supported W3C DOM interface
Based on all the discussion and votes above, here is the count:
Vote Question:
============
==> Which INTERFACE should be the Xerces-C++ public supported W3C DOM
Interface, DOM or IDOM? <===
Vote Count:
=========
14 people has joined the discussion, 3 of them didn't cast a vote explicitly
so I didn't count them in, and the result is
IDOM 9 votes where 2 of them vote with a condition (provided that
memory retained issue can be fixed)
old DOM 2 votes
Based on above votes result, here is my proposal:
Since most users like IDOM interface, and in fact the 2 votes for the old
DOM are suggesting to use IDOM interface internally which sounds like just
another implementation of IDOM.
So I would like to move on to post IDOM interface as the Apache Recommended
C++ DOM Bindings for implementation and as the *RAW* user interface.
But to satisfy those who really like smart pointer approach, the old DOM
will be kept as a viable alternative user interface in addition to the
recommended "RAW" user interface. With Lenny's patch, this old DOM is also
based on the IDOM interface and thus does not "violate" our Apache C++ DOM
Bindings for implementation recommendation. The old DOM interface will
not be deprecated, but will not be promoted as the primary DOM user
interface. The samples will be removed, but the programming guide will
remain and will be documented as a viable alterative user interface for
particular users' preference. And for new development (like DOM Level 3),
IDOM is the first priority.
As for implementation detail, Lenny's patch against the old DOM will be
reviewed and applied (provided the *RAW* IDOM interface users are not
penalized by any performance degradation with this patch, but even if it
does, we will then guard the code with build variation)
And for IDOM memory retained issue, we will review all the alternatives to
see what's the best solution. Also if no one objects, then we will go
ahead and rename IDOM_XXX to DOMXXX as well.
Any comment with this approach?
Tinny
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Call for Vote: which one to be the Xerces-C++ public supported W3C DOM interface
Posted by Rhys Black <pd...@yahoo.com>.
--- Tinny Ng <tn...@ca.ibm.com> wrote:
> Based on all the discussion and votes above, here is
> the count:
>
> Vote Question:
> ============
> ==> Which INTERFACE should be the Xerces-C++
> public supported W3C DOM
> Interface, DOM or IDOM? <===
>
> Vote Count:
> =========
> 14 people has joined the discussion, 3 of them
> didn't cast a vote explicitly
> so I didn't count them in, and the result is
>
> IDOM 9 votes where 2 of them vote with a
> condition (provided that
> memory retained issue can be fixed)
> old DOM 2 votes
>
> Based on above votes result, here is my proposal:
>
> Since most users like IDOM interface, and in fact
> the 2 votes for the old
> DOM are suggesting to use IDOM interface internally
> which sounds like just
> another implementation of IDOM.
>
> So I would like to move on to post IDOM interface as
> the Apache Recommended
> C++ DOM Bindings for implementation and as the *RAW*
> user interface.
>
> But to satisfy those who really like smart pointer
> approach, the old DOM
> will be kept as a viable alternative user interface
> in addition to the
> recommended "RAW" user interface. With Lenny's
> patch, this old DOM is also
> based on the IDOM interface and thus does not
> "violate" our Apache C++ DOM
> Bindings for implementation recommendation. The
> old DOM interface will
> not be deprecated, but will not be promoted as the
> primary DOM user
> interface. The samples will be removed, but the
> programming guide will
> remain and will be documented as a viable alterative
> user interface for
> particular users' preference. And for new
> development (like DOM Level 3),
> IDOM is the first priority.
>
> As for implementation detail, Lenny's patch against
> the old DOM will be
> reviewed and applied (provided the *RAW* IDOM
> interface users are not
> penalized by any performance degradation with this
> patch, but even if it
> does, we will then guard the code with build
> variation)
>
> And for IDOM memory retained issue, we will review
> all the alternatives to
> see what's the best solution. Also if no one
> objects, then we will go
> ahead and rename IDOM_XXX to DOMXXX as well.
>
> Any comment with this approach?
>
> Tinny
Excellent
I would have voted for IDOM as well, had I not been
inundated with programming classwork (taking double
time :) ). I don't have a lot of experience with
IDOM, but I have to say that the lighter memory
footprint is highly desirable in a server setting, and
as many of those using this software se3em to be in
that setting, it should be made a priority.
Thank you
Rhys Black
>
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
RE: Call for Vote: which one to be the Xerces-C++ public supported W3C DOM interface
Posted by Radovan Chytracek <Ra...@cern.ch>.
Hi,
would the following proposal work for most of the developers and users of
Xerces-C?
DOM_XXXXX (original DOM interface)
----------------------------------
This original interface will be adapted on top of patched IDOM by Lenny, using
implicitly reference counting, so for its current users nothing will change.
This interface gets frozen and developers have freedom to play with IDOM
implementation further.
DOMXXXXX
---------
The "official" Xerces-C DOM C++ interface will use IDOM implementation without
implicit use of reference counting thus not forcing this to everybody who
doesn't or can't use it. If needed one can still call the AddRef(),
RemoveRef() and Release() methods in the way it fits his/her purpose.
In both cases one will use DOM handles, the difference is that in the former
case the reference counting operations are invoked automatically by handles
while in the latter the reference counting operations must be invoked
explicitly
Cheers
Radovan
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
RE: Call for Vote: which one to be the Xerces-C++ public supported W3C DOM interface
Posted by Lenny Hoffman <le...@earthlink.net>.
Hi Jason,
Looks like you should avoid the handles, stick to the raw pointer interface,
and expose release though your interface.
> Sorry, I guess I wasn't clear, what I mean is that there will be a
> documented way for people to use the smart pointer interface to DOM
> that does automatic memory collection. If Xerces-Perl is unable to
> support that, then people will try it anyway and get confused.
I think Tinny was suggesting that the primary documented interface would be
the updated IDOM. I would expect some limited verbiage be applied to how to
use handles in your application as a way to gain automated memory
management, but all of the examples would be without handles. Those
examples would have to make it clear which circumstances calls to release
are beneficial in manually managing resources. So long as you note to users
of your binding that handles are not used, then they should not be confused.
BTW, Tinny has expressed that it is more important for the handles to be
backwards compatible with the original DOM than to be a simpler
implementation, which the smart pointer approach would have provided. So
the handles will not be smart pointers after all. Not that you care for
your purpose, just that we have been talking about them as smart pointers
and I just wanted to make that clear.
Lenny
-----Original Message-----
From: Jason E. Stewart [mailto:jason@openinformatics.com]
Sent: Monday, May 06, 2002 2:26 PM
To: xerces-c-dev@xml.apache.org
Cc: lenny.hoffman@objectivity.com
Subject: Re: Call for Vote: which one to be the Xerces-C++ public
supported W3C DOM interface
"Lenny Hoffman" <le...@earthlink.net> writes:
> > The issue is what I would need to do to keep a smart pointer.
>
> Sorry, I haven't used SWIG. Does SWIG only work with pointers?
It isn't a limitation of SWIG, it is an issue of how Perl wraps C/C++
objects/structs, Perl demands a pointer.
> Specifically can perl_sv_setref_pv be modified to take nodes by
> value instead of by pointer? For example would the following work?:
>
> some_wrapper_method ()
> {
> DOM_Element element = ...;
> SV *perl_object = perl_sv_setref_pv('DOM_Element', element);
> ... // return perl_object
> }
No, Perl demands a pointer.
I don't see how you could do it otherwise. Perl knows nothing about
Xerces or DOM_Element, so how could I have a function that took an
object of type DOM_Element and get it to compile, unless it was cast
to a void*? Maybe I'm just lacking creativity, but I don't see how
else it could be done.
If you can suggest an alternative, I'd be extremely interested to hear
it.
> By passing element by value, its behavior as a smart pointer is to not
copy
> the actual node implementation, but properly update its reference
> count.
What I could do, I suppose is invoke the copy constructor:
some_wrapper_method ()
{
DOM_Element element = ...;
SV *perl_object = perl_sv_setref_pv('DOM_Element',
(void*)DOM_Element(element));
... // return perl_object
}
> > It seems I will *have* to force users to explicitly call
> > release(), and that will mean the Xerces-C DOM API has
> > functionality not replicated in Xerces-Perl, which is likely to
> > lead to user confusion for me.
>
> Since release would be part of the Xerces-C DOM API, your replicating it
> should lead to no user confusion.
Sorry, I guess I wasn't clear, what I mean is that there will be a
documented way for people to use the smart pointer interface to DOM
that does automatic memory collection. If Xerces-Perl is unable to
support that, then people will try it anyway and get confused.
> How did you get SWIG to work with the original DOM interface? That
> interface is really a handle interface, so working with these
> handles (as smart pointers not withstanding) should work in a
> similar way. Then you can get automatic memory management and not
> bother your users with having to call release.
Yes, good point. Xerces-Perl handled it rather badly I'm afraid. I
never looked into it properly, because I knew that IDOM was coming,
but basically there was very poor performance, because any method that
returned a handle had to immediately invoke the copy contstructor for
that class to get back a pointer, so there was a *lot* of unnecessary
copying. But also, the memory issues were pretty wierd - I was
convinced that memory was not being properly released but never made
time to properly debug it (because IDOM was coming).
So raw pointers are much simpler for me, much less copying, and the
memory management is explicit. When I'm done with a node, I call
release.
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Call for Vote: which one to be the Xerces-C++ public supported W3C DOM interface
Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"Lenny Hoffman" <le...@earthlink.net> writes:
> > The issue is what I would need to do to keep a smart pointer.
>
> Sorry, I haven't used SWIG. Does SWIG only work with pointers?
It isn't a limitation of SWIG, it is an issue of how Perl wraps C/C++
objects/structs, Perl demands a pointer.
> Specifically can perl_sv_setref_pv be modified to take nodes by
> value instead of by pointer? For example would the following work?:
>
> some_wrapper_method ()
> {
> DOM_Element element = ...;
> SV *perl_object = perl_sv_setref_pv('DOM_Element', element);
> ... // return perl_object
> }
No, Perl demands a pointer.
I don't see how you could do it otherwise. Perl knows nothing about
Xerces or DOM_Element, so how could I have a function that took an
object of type DOM_Element and get it to compile, unless it was cast
to a void*? Maybe I'm just lacking creativity, but I don't see how
else it could be done.
If you can suggest an alternative, I'd be extremely interested to hear
it.
> By passing element by value, its behavior as a smart pointer is to not copy
> the actual node implementation, but properly update its reference
> count.
What I could do, I suppose is invoke the copy constructor:
some_wrapper_method ()
{
DOM_Element element = ...;
SV *perl_object = perl_sv_setref_pv('DOM_Element', (void*)DOM_Element(element));
... // return perl_object
}
> > It seems I will *have* to force users to explicitly call
> > release(), and that will mean the Xerces-C DOM API has
> > functionality not replicated in Xerces-Perl, which is likely to
> > lead to user confusion for me.
>
> Since release would be part of the Xerces-C DOM API, your replicating it
> should lead to no user confusion.
Sorry, I guess I wasn't clear, what I mean is that there will be a
documented way for people to use the smart pointer interface to DOM
that does automatic memory collection. If Xerces-Perl is unable to
support that, then people will try it anyway and get confused.
> How did you get SWIG to work with the original DOM interface? That
> interface is really a handle interface, so working with these
> handles (as smart pointers not withstanding) should work in a
> similar way. Then you can get automatic memory management and not
> bother your users with having to call release.
Yes, good point. Xerces-Perl handled it rather badly I'm afraid. I
never looked into it properly, because I knew that IDOM was coming,
but basically there was very poor performance, because any method that
returned a handle had to immediately invoke the copy contstructor for
that class to get back a pointer, so there was a *lot* of unnecessary
copying. But also, the memory issues were pretty wierd - I was
convinced that memory was not being properly released but never made
time to properly debug it (because IDOM was coming).
So raw pointers are much simpler for me, much less copying, and the
memory management is explicit. When I'm done with a node, I call
release.
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
RE: Call for Vote: which one to be the Xerces-C++ public supported W3C DOM interface
Posted by Lenny Hoffman <le...@earthlink.net>.
Hi Jason,
> The issue is what I would need to do to keep a smart pointer.
Sorry, I haven't used SWIG. Does SWIG only work with pointers? Specifically
can perl_sv_setref_pv be modified to take nodes by value instead of by
pointer? For example would the following work?:
some_wrapper_method ()
{
DOM_Element element = ...;
SV *perl_object = perl_sv_setref_pv('DOM_Element', element);
... // return perl_object
}
By passing element by value, its behavior as a smart pointer is to not copy
the actual node implementation, but properly update its reference count.
The reason that I figured that using smart pointers would mean fewer updates
for you than using handles that were not is because current code you have
like this:
IDOM_Element* element = ...;
IDOM_Node* node = element->getFirstChild();
would become (assuming a different naming convention for handles as smart
pointers):
DOMElementH element = ...;
DOMNodeH node = element->getFirstChild();
as compared to (handles not as smart pointers):
DOM_Element element = ...;
DOM_Node node = element.getFirstChild();
Note that the handle as a smart pointer allows you to continue to use the ->
operator as if you were still working with raw pointers. This means that
going to handles as smart pointers requires only one type of change, where
going to handles as full interface (backwards compatible with original DOM)
would require two types of change.
> It seems I will *have* to force
> users to explicitly call release(), and that will mean the Xerces-C
> DOM API has functionality not replicated in Xerces-Perl, which is
> likely to lead to user confusion for me.
Since release would be part of the Xerces-C DOM API, your replicating it
should lead to no user confusion.
How did you get SWIG to work with the original DOM interface? That
interface is really a handle interface, so working with these handles (as
smart pointers not withstanding) should work in a similar way. Then you can
get automatic memory management and not bother your users with having to
call release.
Lenny
-----Original Message-----
From: Jason E. Stewart [mailto:jason@openinformatics.com]
Sent: Monday, May 06, 2002 12:02 PM
To: xerces-c-dev@xml.apache.org
Cc: lenny.hoffman@objectivity.com
Subject: Re: Call for Vote: which one to be the Xerces-C++ public
supported W3C DOM interface
"Lenny Hoffman" <le...@earthlink.net> writes:
> Am I missing something here?
Probably, not ;-)
It's usually my lack of C++ knowledge.
> > To track the underlying C++ objects, Xerces-Perl keeps a pointer
> > to the object, so all my method calls will be pointer invocations.
>
> I don't understand what the problem is. You can continue to keep a
pointer,
> or you can keep a smart pointer.
The issue is what I would need to do to keep a smart pointer.
I use SWIG to generate all my wrapper code - so in some sense I am
constrained by how SWIG generates wrappers. Let's for a moment forget
this, and say I was doing it by hand.
If my wrapper code generated smart pointers like so:
some_wrapper_method ()
{
DOM_Element element = ...;
SV *perl_object = perl_sv_setref_pv('DOM_Element', &element);
... // return perl_object
}
how will the smart pointer know that it hasn't gone out of scope and
release itself automatically, thus leaving me with a bad pointer?
> I thought you said you currently support the IDOM. If you are happy with
> that, then all you need to do is renamed IDOM_* to DOM*.
already done.
> You don't have to use the smart pointer handles if you don't want
> the benefit of automatic calls to release, either because you will
> be explicitly calling release when needed or you don't care about
> memory growth.
;-)
Believe me I would like automatic memory release, I'm just at a loss
to figure out how I can get to it. It seems I will *have* to force
users to explicitly call release(), and that will mean the Xerces-C
DOM API has functionality not replicated in Xerces-Perl, which is
likely to lead to user confusion for me.
> If you did decide to gain the benefit of handles, then their being
> smart pointers would mean fewer updates for you, not more, as the
> handles as smart pointers act quite a bit like the raw pointers you
> are using today.
If you can help me understand how to use them, then I will be very
happy.
Pardon my denseness,
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Call for Vote: which one to be the Xerces-C++ public supported W3C DOM interface
Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"Lenny Hoffman" <le...@earthlink.net> writes:
> Am I missing something here?
Probably, not ;-)
It's usually my lack of C++ knowledge.
> > To track the underlying C++ objects, Xerces-Perl keeps a pointer
> > to the object, so all my method calls will be pointer invocations.
>
> I don't understand what the problem is. You can continue to keep a pointer,
> or you can keep a smart pointer.
The issue is what I would need to do to keep a smart pointer.
I use SWIG to generate all my wrapper code - so in some sense I am
constrained by how SWIG generates wrappers. Let's for a moment forget
this, and say I was doing it by hand.
If my wrapper code generated smart pointers like so:
some_wrapper_method ()
{
DOM_Element element = ...;
SV *perl_object = perl_sv_setref_pv('DOM_Element', &element);
... // return perl_object
}
how will the smart pointer know that it hasn't gone out of scope and
release itself automatically, thus leaving me with a bad pointer?
> I thought you said you currently support the IDOM. If you are happy with
> that, then all you need to do is renamed IDOM_* to DOM*.
already done.
> You don't have to use the smart pointer handles if you don't want
> the benefit of automatic calls to release, either because you will
> be explicitly calling release when needed or you don't care about
> memory growth.
;-)
Believe me I would like automatic memory release, I'm just at a loss
to figure out how I can get to it. It seems I will *have* to force
users to explicitly call release(), and that will mean the Xerces-C
DOM API has functionality not replicated in Xerces-Perl, which is
likely to lead to user confusion for me.
> If you did decide to gain the benefit of handles, then their being
> smart pointers would mean fewer updates for you, not more, as the
> handles as smart pointers act quite a bit like the raw pointers you
> are using today.
If you can help me understand how to use them, then I will be very
happy.
Pardon my denseness,
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
RE: Call for Vote: which one to be the Xerces-C++ public supported W3C DOM interface
Posted by Lenny Hoffman <le...@earthlink.net>.
Hi Jason,
> To track the underlying C++ objects, Xerces-Perl keeps a pointer
> to the object, so all my method calls will be pointer invocations.
I don't understand what the problem is. You can continue to keep a pointer,
or you can keep a smart pointer. I have never done any Perl wrappers, but I
have done significant Python wrapping (not Xerces), and I know that I could
do it either way.
I thought you said you currently support the IDOM. If you are happy with
that, then all you need to do is renamed IDOM_* to DOM*. You don't have to
use the smart pointer handles if you don't want the benefit of automatic
calls to release, either because you will be explicitly calling release when
needed or you don't care about memory growth. If you did decide to gain the
benefit of handles, then their being smart pointers would mean fewer updates
for you, not more, as the handles as smart pointers act quite a bit like the
raw pointers you are using today.
Am I missing something here?
Lenny
-----Original Message-----
From: Jason E. Stewart [mailto:jason@openinformatics.com]
Sent: Monday, May 06, 2002 10:35 AM
To: xerces-c-dev@xml.apache.org
Cc: lenny.hoffman@objectivity.com; Tinny Ng
Subject: Re: Call for Vote: which one to be the Xerces-C++ public
supported W3C DOM interface
"Lenny Hoffman" <le...@earthlink.net> writes:
> The smart pointer approach should also be easier to explain in the
> programmers guide. For example it can be explained that when wishing to
> have automated "in use" indication assign returned nodes to handles:
>
> {
> DOM_Element element = ...;
> DOM_Node node = ...;
> element->removeChild(node);
> ...
> } // release on removed child called here automatically
>
> Or if wishing to avoid handles assign to pointers and explicitly call
> release:
>
> {
> DOMElement* element = ...;
> DOMNode* node = ...;
> element->removeChild(node);
> ...
> node->release();
> }
The smart pointer approach sounds clever. It has a serious drawback,
for me anyway, which is that it cannot work for the Perl API (or the
Python API most likely), at least not without significant hackery on my
part. To track the underlying C++ objects, Xerces-Perl keeps a pointer
to the object, so all my method calls will be pointer invocations.
Also, it will most likely mean the Xerces-C documentation becomes
significantly out of line with Xerces-Perl.
Smart pointers are also a bitch for people like me who only program in
C++ when we *have* to to try and figure out what other peoples code is
doing.
my $0.05,
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Call for Vote: which one to be the Xerces-C++ public supported W3C DOM interface
Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"Lenny Hoffman" <le...@earthlink.net> writes:
> The smart pointer approach should also be easier to explain in the
> programmers guide. For example it can be explained that when wishing to
> have automated "in use" indication assign returned nodes to handles:
>
> {
> DOM_Element element = ...;
> DOM_Node node = ...;
> element->removeChild(node);
> ...
> } // release on removed child called here automatically
>
> Or if wishing to avoid handles assign to pointers and explicitly call
> release:
>
> {
> DOMElement* element = ...;
> DOMNode* node = ...;
> element->removeChild(node);
> ...
> node->release();
> }
The smart pointer approach sounds clever. It has a serious drawback,
for me anyway, which is that it cannot work for the Perl API (or the
Python API most likely), at least not without significant hackery on my
part. To track the underlying C++ objects, Xerces-Perl keeps a pointer
to the object, so all my method calls will be pointer invocations.
Also, it will most likely mean the Xerces-C documentation becomes
significantly out of line with Xerces-Perl.
Smart pointers are also a bitch for people like me who only program in
C++ when we *have* to to try and figure out what other peoples code is
doing.
my $0.05,
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
RE: Call for Vote: which one to be the Xerces-C++ public supported W3C DOM interface
Posted by Lenny Hoffman <le...@earthlink.net>.
Hi Tinny,
We have a choice here in how we implement our handles: keep backwards
capability with the original DOM interfaces at the cost of maintaining a
full dual interface, or sacrifice backwards compatibility with the original
DOM, but gain simplified maintenance, and possibly an easier interface to
understand. Let me explain --
I had originally kept the DOM_ interfaces, but had them delegate to the IDOM
for anything that they did (this gives us the greatest backwards
compatibility with the original DOM). But in the recent discussion I
thought you made the point that having such duplication of interfaces
represented increased maintenance, so I proposed changing the DOM_
interfaces so that they are smart pointers, thus eliminating method
duplication (this loses backwards compatibility with the original DOM). For
example, instead of:
DOM_Element element = ...;
DOM_Node first = element.getFirstChild();
where there is both a DOM_Element::getFirstChild and an
DOMElement::getFirstChild, you would have:
DOM_Element element = ...;
DOM_Node first = element->getFirstChild();
where there is only DOMElement::getFirstChild. Having the DOM_ interfaces
be simple smart pointers that delegate to methods using a single
overloaded -> operator instead of multiple methods for each method on a node
interface. In fact in my prototype I was able to do in a single header file
what was done in 14. With main development going forward on the renamed
IDOM interfaces, this approach offers the advantage of quick and easy
turnaround on adding handle support to new interfaces.
The smart pointer approach should also be easier to explain in the
programmers guide. For example it can be explained that when wishing to
have automated "in use" indication assign returned nodes to handles:
{
DOM_Element element = ...;
DOM_Node node = ...;
element->removeChild(node);
...
} // release on removed child called here automatically
Or if wishing to avoid handles assign to pointers and explicitly call
release:
{
DOMElement* element = ...;
DOMNode* node = ...;
element->removeChild(node);
...
node->release();
}
However release is called on a node, either by an implementation reference
counting with the help of handles or explicitly, it indicates to the
implementation that there are no longer any clients to the node and that it
resources could be released or recycled. The memory growth fix I came up
with for the IDOM, for example, would recycle memory for the node and its
strings upon a call to release if that node were no longer part of the
document.
Since you and others were willing to forgo the original DOM altogether, I
got the impression that backwards compatibility with it was not too
important. As you can see, the methods accessed via the smart pointer's ->
operator are really on the new IDOM interfaces and thus are not backwards
compatible with the original DOM.
Although I lean toward the simpler smart pointer approach, I can go either
way, just let me know.
Lenny
-----Original Message-----
From: Tinny Ng [mailto:tng-xml@ca.ibm.com]
Sent: Monday, May 06, 2002 9:27 AM
To: xerces-c-dev@xml.apache.org; lenny.hoffman@objectivity.com
Subject: Re: Call for Vote: which one to be the Xerces-C++ public
supported W3C DOM interface
>
> BTW, the handles are no longer backward compatible with the original DOM_
> classes, and thus should follow a different naming convention. Since you
> are renaming the IDOM_* classes to DOM*, perhaps the handles could be
named
> DOM*_h. This is just my initial thought, you may have a better idea.
>
As indicated in my other post, I don't really want to rename the old DOM
interface. In fact how incompatible are the handles going to be? Except
the removal of "XML_DECL", I would prefer to keep compatibility as much as
possible in the old DOM interface after the patch.....
Tinny
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Call for Vote: which one to be the Xerces-C++ public supported W3C DOM interface
Posted by Tinny Ng <tn...@ca.ibm.com>.
>
> BTW, the handles are no longer backward compatible with the original DOM_
> classes, and thus should follow a different naming convention. Since you
> are renaming the IDOM_* classes to DOM*, perhaps the handles could be
named
> DOM*_h. This is just my initial thought, you may have a better idea.
>
As indicated in my other post, I don't really want to rename the old DOM
interface. In fact how incompatible are the handles going to be? Except
the removal of "XML_DECL", I would prefer to keep compatibility as much as
possible in the old DOM interface after the patch.....
Tinny
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
RE: Call for Vote: which one to be the Xerces-C++ public supported W3C DOM interface
Posted by Lenny Hoffman <le...@earthlink.net>.
Hi Tinny,
I have no problem with your direction. I will rework my patch consistent
with the discussion (simplify handles to not replicate IDOM methods, make
reference counting optional, make thread safe reference counting optional)
and re-base it on the latest nightly build (2002-05-03) -- it was based on
1.6. This should take me at least a few days (given my other
responsibilities). I will attach it to 5967 when done.
BTW, the handles are no longer backward compatible with the original DOM_
classes, and thus should follow a different naming convention. Since you
are renaming the IDOM_* classes to DOM*, perhaps the handles could be named
DOM*_h. This is just my initial thought, you may have a better idea.
Thanks,
Lenny
-----Original Message-----
From: Tinny Ng [mailto:tng-xml@ca.ibm.com]
Sent: Friday, May 03, 2002 3:06 PM
To: xerces-c-dev@xml.apache.org
Subject: Re: Call for Vote: which one to be the Xerces-C++ public
supported W3C DOM interface
Based on all the discussion and votes above, here is the count:
Vote Question:
============
==> Which INTERFACE should be the Xerces-C++ public supported W3C DOM
Interface, DOM or IDOM? <===
Vote Count:
=========
14 people has joined the discussion, 3 of them didn't cast a vote explicitly
so I didn't count them in, and the result is
IDOM 9 votes where 2 of them vote with a condition (provided that
memory retained issue can be fixed)
old DOM 2 votes
Based on above votes result, here is my proposal:
Since most users like IDOM interface, and in fact the 2 votes for the old
DOM are suggesting to use IDOM interface internally which sounds like just
another implementation of IDOM.
So I would like to move on to post IDOM interface as the Apache Recommended
C++ DOM Bindings for implementation and as the *RAW* user interface.
But to satisfy those who really like smart pointer approach, the old DOM
will be kept as a viable alternative user interface in addition to the
recommended "RAW" user interface. With Lenny's patch, this old DOM is also
based on the IDOM interface and thus does not "violate" our Apache C++ DOM
Bindings for implementation recommendation. The old DOM interface will
not be deprecated, but will not be promoted as the primary DOM user
interface. The samples will be removed, but the programming guide will
remain and will be documented as a viable alterative user interface for
particular users' preference. And for new development (like DOM Level 3),
IDOM is the first priority.
As for implementation detail, Lenny's patch against the old DOM will be
reviewed and applied (provided the *RAW* IDOM interface users are not
penalized by any performance degradation with this patch, but even if it
does, we will then guard the code with build variation)
And for IDOM memory retained issue, we will review all the alternatives to
see what's the best solution. Also if no one objects, then we will go
ahead and rename IDOM_XXX to DOMXXX as well.
Any comment with this approach?
Tinny
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org