[jdom-interest] protected ContentList in Document

Elliotte Rusty Harold elharo at metalab.unc.edu
Sun May 4 11:37:45 PDT 2003


Resending an issue from last year to get it back in the queue:

The org.jdom.Document class has this protected field:

    protected ContentList content = new ContentList(this);

However, the ContentList class is package private so this field isn't 
truly accessible to subclasses. I think we should either

1. Make the content field private (My preferred option)
2. Make ContentList a public class
3. Declare the content field to have type List rather than ContentList

The protected attributes and content fields in the Element class have 
the same issues:

    /** The attributes of the <code>Element</code>. */
    protected AttributeList attributes = new AttributeList(this);

    /** The mixed content of the <code>Element</code>. */
    protected ContentList content = new ContentList(this);


At the time, David Lucas pointed out:

Also, the Element.clone() method assumes that content and attributes 
is only defined in the current class.  The constructor for Element 
also creates the values for attributes and contentList which would 
not give any other class the opportunity to extend and modify the 
usage of the protected values.




-- 
Elliotte Rusty Harold
elharo at metalab.unc.edu
Processing XML with Java (Addison-Wesley, 2002)
   http://www.cafeconleche.org/books/xmljava
   http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA



More information about the jdom-interest mailing list