[jdom-interest] setNamespace question
Jochen Strunk
strunk at signal7.de
Fri Mar 30 02:42:22 PST 2001
There is one thing about the namespace discussion I don' t understand.
Compare the following two statements:
element = element.getCopy(element.getName(),
Namespace.getNamespace("http://foo"));
element.setNamespace("http://foo");
The first example works by first making an exact copy of element in a
different namespace and handing over the original element to the garbage
collector. The result is a different element represented by a different
java object. The second statement would also yield a different element but
represented by the same java object.
I haven't been following the discussion from the beginning but I think you
don't provide a setNamespace method mainly because you are saying namespace
is intrinsic to an element and does not change. That is why we have to use
getCopy for that purpose. Am I right with this assumption ?
If that is correct, I don't understand why a different element can not be
represented by the same java object. Why is a different element required to
live on a different java object ?
jochen
(-) Jochen Strunk
(-) SIGNAL 7 Gesellschaft für Informationstechnologie mbH
(-) Brüder-Knauß-Str. 79 - 64285 Darmstadt,
(-) Tel: 06151 665402, Fax: 06151 665373
(-) strunk at signal7.de, www.signal7.de
More information about the jdom-interest
mailing list