You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Christophe Jolif <cj...@ilog.fr> on 2001/05/14 13:28:02 UTC

[crimson] createElement/createElementNS

Hello,

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?

Thanks,
-- 
Christophe

---------------------------------------------------------------------
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


Re: [crimson] createElement/createElementNS

Posted by Christophe Jolif <cj...@ilog.fr>.

Edwin Goei wrote:

> 
> I just made setOwnerDocument() protected in the current CVS.
> 

Thanks!

-- 
Christophe

---------------------------------------------------------------------
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


Re: [crimson] createElement/createElementNS

Posted by Edwin Goei <ed...@sun.com>.
Christophe Jolif wrote:
> 
> 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
> work).
> 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?

I just made setOwnerDocument() protected in the current CVS.

-Edwin

---------------------------------------------------------------------
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


Re: [crimson] createElement/createElementNS

Posted by Christophe Jolif <cj...@ilog.fr>.

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
work).
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?

Thanks,
-- 
Christophe

---------------------------------------------------------------------
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


Re: [crimson] createElement/createElementNS

Posted by Edwin Goei <ed...@sun.com>.
Christophe Jolif wrote:
> 
> Hello,
> 
> 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.

-Edwin

---------------------------------------------------------------------
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