[jdom-interest] First pass at Namespace revision[eg]
jhunter at acm.org
Tue Apr 3 21:03:53 PDT 2001
James Duncan Davidson wrote:
> > I forget when and why getCopy() got added. It was probably a compromise
> > to avoid adding setName() and setNamespace() methods to Element. But
> > frankly it strikes me as weird and unnecessary. I'd prefer to delete it
> > from the Element class. It could plausibly belong in a separate
> > JDOMUtils class or package, but I'd prefer not to clutter the core API
> > with it.
> I've not no opinion on getCopy except that it would seem that clone
> would work in this situation, no?
Yes, if setName() and setNamespace() are added we can lose the two
getCopy() variants. It's a net zero API change. :-)
> For setName()/space() -- these methods *should* be added to the API. The
> use case for this is data manipulation from one XML doc to another with
> the same elements/data. Say I've got a servlet receiving content from
> the web in XML and I'm going to write it to disk, but first I want to
> change it to my own thoughts of what the XML should be -- if I can't use
> a setName, then I have to do XSLT -- way too much overhead for something
> so simple -- especially if I've already got the data in JDOM.
I believe this is a strong use case: basically a translation tool for
when XSLT just isn't worth the trouble (or the overhead). This use case
adds to the pile of evidence that JDOM programmers want the ability to
change the element names and namespaces in memory.
So... I believe we should add setName() and setNamespace() and deprecate
More information about the jdom-interest