<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>Common interface for &quot;node&quot; classes.</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>I've been working with JDOM for creating object models for semi-complicated XML, and it's been great.&nbsp; One of the smaller nits I'm constantly picking is the lack of a shared type for &quot;node&quot; classes like Element and Text.&nbsp; Common tasks like getParent and detach should be specified by a common interface, say JDOMNode or some such thing.&nbsp; </FONT></P>

<P><FONT SIZE=2>For example...</FONT>
</P>

<P><FONT SIZE=2>// Methods of particular interest to Jerome for the</FONT>
<BR><FONT SIZE=2>// immediate future. :)</FONT>
<BR><FONT SIZE=2>interface JDOMNode{</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>public JDOMNode detach();</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>public Element getParent();</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>

<P><FONT SIZE=2>class Element implements Serializable, Cloneable, JDOMNode{ .... }</FONT>
<BR><FONT SIZE=2>class Text implements Serializable, Cloneable, JDOMNode{ .... }</FONT>
</P>

<P><FONT SIZE=2>This would mean not having to check for explicit types before casting while iterating over child collections, which would be handy-dandy, IMO.&nbsp; I know there was some brief discussion of this kind of thing in the list archives, but I don't know if anything was ever decided.&nbsp; I know it starts to tinker with existing interfaces, but I think it's a good thing.</FONT></P>

<P><FONT SIZE=2>Polymorphism.&nbsp; It's not just for breakfast anymore.</FONT>
</P>

<P><FONT SIZE=2>Thanks!</FONT>
</P>

<P><FONT SIZE=2>--</FONT>
<BR><FONT SIZE=2>Jerome O'Neil</FONT>
<BR><FONT SIZE=2>Sr. Software Engineer</FONT>
<BR><FONT SIZE=2>The Cobalt Group</FONT>
<BR><FONT SIZE=2>206.219.8008 </FONT>
</P>

</BODY>
</HTML>