xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe Jolif <cjo...@ilog.fr>
Subject Re: [crimson] createElement/createElementNS
Date Tue, 22 May 2001 08:09:21 GMT

Edwin Goei wrote:

> > Moving from JAXP1.0.x to JAXP1.1, the crimson DOM has deprecated the
> > factory API. That's why instead of using it, I would like to subclass
> > the XmlDocument and redefine the createElement and createElementNS
> > methods to return customized elements for some tag names. It works fine
> > with createElementNS but createElement is final and thus cannot be
> > redefine.
> >
> > Is it really intended? Is their any chances that it changed?
> I'm not sure what the original reason was for doing this, since that
> decision was made before I started working on the code.  Probably the
> original author wanted to steer developers to the element factory code
> or maybe it was for performance.  I would expect newer apps would be
> using Namespaces and thus the createElementNS() method.  The old element
> factory code still works for non-namespace XML docs for backward
> compatibility.  In any case, I just made it non-final in the latest CVS
> version.

Thanks a lot for your answer Edwin,

I now have a second issue in the same area. I redefined the
createElementNS (non final) method to create instances of my own
subclass of ElementNode2. However I still have a little problem, the
setOwnerDocument method on ElementNode2 (in fact NodeBase) is not
accessible outside of the crimson package, that's why I can't set the
owner document on my customized elements in my createElementNS method
(as it is done in XmlDocument method). It would be possible to set it if
this method was protected or if the ElementNode2 constructor was taken
the ownerDocument as parameter (I though about another solution that
would not require to modify crimson: it was to redefine the
getOwnerDocument() (not final) method on my subclasss of ElementNode2,
however in some places in crimson code the owner document is not get
through this method but directly by accessing the ownerDocument field =>
this solution that doesn't require to modify crimson doesn't actually
I think that if crimson allows to redefine the createElementNS method,
it should in a way or another let the user set the owner document on it.
Do you have a solution that I would not have seen about this or should
it be corrected in crimson?


In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org

View raw message