[jdom-interest] getName(), getLocalName(), and getQualifiedName()

Bradley S. Huffman hip at a.cs.okstate.edu
Tue Aug 13 17:00:27 PDT 2002


Elliotte Rusty Harold writes:

> Currently, the getName() method in both Element and Attribute is defined 
> to return the local name. The getQualifiedName() method returns the full 
> name including prefix.
> 
> Unfortuantely according to XML 1.0, the "name" is the qualified name, 
> not the local name. Namespaces in XML does not change this; that is, it 
> does not redefine "name" as local name. It simply introduces new 
> concepts of local name and qualified name. Logically, the getName() 
> method should return the qualified name. A getLocalName() method could 
> return the local name, but getName() should really return what XML 1.0 
> defines as the element or attribute's name.
> 
> Alternately, we could use getQualifiedName() and getLocalName(), and 
> eliminate (after deprecation) getName(). This is also completely 
> consistent with XML 1.0, is less ambiguous, and would be much more 
> compatible with existing code. Thoughts?

I have no strong feelings either way about changing getName()/setName() to
getLocalName()/setLocalName(). But if we do start changing names to better
match the spec.s, I think we should also changed our usage of "children"
to be more in line with DOM. Currently this seems to cause much confusion
for those moving from DOM to JDOM, which is probably how most people come
to use JDOM.

Brad



More information about the jdom-interest mailing list