[jdom-interest] Namespace inheritance after cloning
elharo at metalab.unc.edu
Mon Nov 29 04:42:49 PST 2004
Eric VERGNAUD wrote:
> Don't enter this subject Alistair, it's in the "pragmatic programmers
> against ayatollahs" area.
This is a crock. There is no conflict here. What you call the ayatollah
approach is the pragmatic one. Making namespaces change depending on
where an element was placed in a document or which document it was
placed in would be hard to use, fragile, brittle, and confusing. It
would make code extremely hard to maintain and debug, and extremely
slow, even in the rare cases where it wasn't actively wrong. This
approach would cause far more problems than it solves, and sooner rather
The problem is not that there is too much overhead to supporting two
approaches. The problem is that one of the approaches (letting namespace
URIs change depending on element position) is flat-out wrong. It is
actively contrary to how namespaces are supposed to work in XML.
I agree that the namespace syntax and scoping in XML is excessively
confusing. This is hardly the only problem it causes. However, it is not
JDOM's place to "fix" the brokenness of namespaces. JDOM's namespace
handling is simply correct. It is substantially more correct than DOM's.
If you are getting confused when using namespaces with JDOM, then that
is because you are confused about namespaces; and it is better that you
detect and correct your confusion sooner rather than later. JDOM helps
you do that. There is no upside to enabling developers' mistaken beliefs
about namespaces. A good API makes it easy to do things the right way
and hard to impossible to do things the wrong way; and this is exactly
what JDOM is doing.
Elliotte Rusty Harold elharo at metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
More information about the jdom-interest