DOM and java downcast versus query interface

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 UTC