[jdom-interest] Setting the parents of Attributes

Deepak Natarajan natarajan at mofile.com
Mon Oct 1 05:23:39 PDT 2001


JDOM Guru's and Patrons,

I apologize if i'm flogging a dead horse here,

but when the setAttributes(List) method of org.jdom.Element is invoked,
shouldn't the parents of all the attributes in this list be set?

The current method body is as follows:
    public Element setAttributes(List attributes) {
        // XXX Verify attributes are all parentless first
        this.attributes = attributes;
        return this;
    }

I had to change it to this, to make a client work:

    public Element setAttributes(List attributes) {
        // XXX Verify attributes are all parentless first
        this.attributes = attributes;

        // just another bug fix - AS
        Iterator iter = attributes.iterator();
        while (iter.hasNext())
        {
            Object o = iter.next();
            if (o instanceof Attribute)
                ((Attribute)o).setParent(this);
        }
        return this;
    }

The reason I had to do this: I needed to retrieve an attributes document,
and ran into an exception.

Thanks and cheers,
-deepak natarajan





_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com




More information about the jdom-interest mailing list