Re: question about Tidy

Hi, Gary

I am TRULY glad you still remember me. You are so kind. I think we
will definitely have a chance to talk in the future. May be very soon,
maybe within this year. Or even face to face ? I hope I can say thanks to
you directly like that.

You exactly hit the point of my question.

I have some knowledge of interface and implements in java. I am still not
clear enough about my question in last email to you. Because when I see
inside of the source code of Tidy.java, the return type of parseDOM() 
is org.w3c.dom.Document, which is not org.w3c.tidy.DOMNodeImpl. 

I know dom.Document extends dom.Node, which means dom.Document is a
dom.Node. And I also know tidy.DOMNodeImpl implements dom.Node.......I am
totally confused with all these "cross" relations. (because the
implementation of the methods in dom.Node interface is in tidy.DOMNodeImpl
class.)

Help me.

By the way, what is the difference between tidy.Node and dom.Node?

Thank you VERY much.


Major 



On Mon, 12 Feb 2001, Gary L Peskin wrote:

> Chunbo Shao wrote:
> > 
> > Hello, Gary
> > 
> > I hope you still remember me. I still work on JTidy a lot. I have
> > question.
> > 
> > There is "Node" interface in dom package, and there is "DOMNodeImpl" class
> > to implement this interface.
> > In the example file attached (which comes from the jtidy help html), I see
> > the code of "node.getNodeName()",
> > where node is an instance of dom.Node. I know there is implementation of
> > getNodeName() method inside of
> > "DOMNodeImpl" class which is in the tidy package. BUT i really cannot see
> > how this method can be invoked by the above call:
> > "node.getNodeName()". PLease help me.
> > 
> > Great thanks. If any of my description is not clear, please tell me as
> > soon as possible.
> > 
> > Looking forward to kind reply.
> 
> Hi, Major --
> 
> Nice to hear from you.  I think your questions is "How does the
> DOMNodeImpl.getNodeName() method get invoked from the sample code?"
> 
> As you said, DOMNodeImpl implements the org.w3c.dom.Node interface. 
> org.w3c.dom.Node is an interface specified by the w3c as part of their
> DOM project:
> See
> http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-1950641247
> 
> In the sample code, node is a Node that is passed in to the print()
> method.  The print() method, in turn, is initially invoked from the
> main() method in the statement
> 
>   t.print(tidy.parseDOM(in, null));
> 
> The tidy.parseDOM method actually returns a DOMNodeImpl which is also
> considered a Node since DOMNodeImpl implements the Node interface.
> 
> This whole concept requires a good understanding of how interfaces work
> and interact with the classes that implement them.  You may want to
> review some of the material on the java site in this regard.
> 
> I hope this answers your question.  If you need further clarification,
> please let me know.
> 
> Gary
> 

Received on Tuesday, 13 February 2001 00:22:30 UTC