axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aleksander Slominski <>
Subject Re: [Axis2] OMNodeImpl notes
Date Tue, 12 Apr 2005 16:04:13 GMT
jayachandra wrote:

>Hi devs!
>Currently OMNodeImpl has the data memeber 'parent' of type OMElement.
>This appears problematic. Because for document level comments (i mean,
>comments that are present outside the root element in the XML
>document) parent becomes OMDocument rather than OMElement. So better
>have the 'parent' data member as Object. And accordingly the return
>type of getParent will be Object. I hope this change will not break
>any existing code, will it???
hi Jaya,

IMHO Object is a bit too broad and will be hard to understand when 
somebody see Object getParent() what are legal values for parent - 
instead you could create a common base interface for OMElement and 
OMDocument (OMContainer?) and use it as result of getParent - i did this 
in XPP3/XB1 and it works well for the case you mention and similiar 
situation suchas top level element that is child of document (so called 
document element).

you can get more sophisticated about it and also model containment 

 * Common abstraction shared between XmlElement, XmlDocument and XmlDoctype
 * to represent XML Infoset item that can contain other Infoset items
 * This is useful so getParent() operation will return this instead of 
Object ...
public interface XmlContainer {

 * Common abstraction to represent XML infoset item that are contained 
in other infoet items
 * This is useful so parent can be updated on contained items when 
container is cloned ...
public interface XmlContained{
    public XmlContainer getParent();
    public void setParent(XmlContainer el);

public interface XmlElement extends XmlContainer, XmlContained, Cloneable {

public interface XmlDocument extends XmlContainer, Cloneable {



The best way to predict the future is to invent it - Alan Kay

View raw message