W3C home > Mailing lists > Public > html-tidy@w3.org > January to March 2001

Re: question about Tidy

From: Gary L Peskin <garyp@firstech.com>
Date: Mon, 12 Feb 2001 15:02:48 -0800
Message-ID: <3A886B98.7429D5D2@firstech.com>
To: Chunbo Shao <cxs0187@omega.uta.edu>
CC: sami@lempinen.net, dsr@w3.org, html-tidy@w3.org
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:

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.

Received on Monday, 12 February 2001 18:04:32 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:49 UTC