W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2003

DOM and java downcast versus query interface

From: Christophe Cornu <Christophe_Cornu@ca.ibm.com>
Date: Wed, 16 Jul 2003 15:46:36 -0400
To: WWW DOM <www-dom@w3.org>
Message-ID: <OFC5C74609.427B842D-ON85256D65.00698AFC@torolab.ibm.com>
The w3c dom provides a java binding. Does the DOM specification require to 
suppport model 1 or model 2 below?

org.w3c.dom.Node node;
org.w3c.dom.html2.HTMLAnchorElement anchor;
...
anchor  = (HTMLAnchorElement)node.getFirstChild(); /* model 1 */
or 
anchor = CustomClass.queryInterface(node.getFirstChild(), 
"HTMLAnchorElement"); /* model 2 */

Model 1 is more familiar in a java world. However, Model 2 can be more 
natural when the java binding is implemented over a C++ native dom 
library.  Thanks for any pointer on this.

Chris
Received on Wednesday, 16 July 2003 15:46:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:57 GMT