You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by George Papamarkos <g....@dcs.bbk.ac.uk> on 2003/05/22 22:40:21 UTC

Instantiating NodeImpl etc.

Hi guys,
            I am currently using Xerces in doing some parsing and
manipulation of XML in parallel with Xalan.
I've made some attemtps to extend the NodeImpl class from Xerces DOM
Implementation API but I could make this think work. Actually I want to
extend this class in order to use some of the protected fields and methods
that it contains but I could find any example or a guide of how can I
subclass and use the facilities of NodeImpl.
Has anyone of you ever used this class ? And if yes can please give me a
example that illustrates how can I instantiate it and associate it with a
new XML document using all these that are mentioned in the JavaDoc (
Document Factory etc.)
I would really appriciate any kind of help.

Best Regards,

George


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Instantiating NodeImpl etc.

Posted by Arno Schatz <li...@arnoschatz.de>.
Hi,

The problem with extending NodeImpl is that many other classes subclass NodeImpl. So if 
you subclass NodeImpl, your subclass actually doesn't get used unless you want to rewrite 
all subclasses of NodeImpl too.

However, if you just want to access protected stuff, just create a class with the package 
name same as NodeImpl. Since that class will be in the same package, you will have access 
to all protected and package wide variables / methods! This is really easy to do, but one 
thing to keep in mind: you class needs to be loaded from the same classloader, otherwise 
you get an exception while attempting to access the Xerces classes. (Which means for 
Tomcat users, you need to remove the XercesImpl.jar from common/endoresed directory)

hope that helps,
   Arno


George Papamarkos wrote:
> Hi guys,
>             I am currently using Xerces in doing some parsing and
> manipulation of XML in parallel with Xalan.
> I've made some attemtps to extend the NodeImpl class from Xerces DOM
> Implementation API but I could make this think work. Actually I want to
> extend this class in order to use some of the protected fields and methods
> that it contains but I could find any example or a guide of how can I
> subclass and use the facilities of NodeImpl.
> Has anyone of you ever used this class ? And if yes can please give me a
> example that illustrates how can I instantiate it and associate it with a
> new XML document using all these that are mentioned in the JavaDoc (
> Document Factory etc.)
> I would really appriciate any kind of help.
> 
> Best Regards,
> 
> George
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org