[jdom-interest] Setting the parents of Attributes
Deepak Natarajan
nataraja at cs.fsu.edu
Wed Sep 26 01:55:11 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
More information about the jdom-interest
mailing list