[jdom-interest] Re: Radical Suggestion (was Re: Antwort: RE: [jdom-interest] Namespacehelp)

Jason Hunter jhunter at acm.org
Thu Jul 25 12:28:31 PDT 2002

Elliotte has the best argument why we can't implement a fancy namespace
inheritance model:  Your <table> element is either an XHTML table or a
Furniture table and must always stay in the appropriate namespace
regardless of where it moves in the tree.

Plus, my personal opinion is that if you think there are questions now,
imagine if namespaces were inherited!  People would move elements,
they'd change namespaces, and subtle bugs would waste countless hours. 
It'd be a nightmare!

The current model is predictable, appropriate for XML, and exposes any
misconceptions right away.  That's all very important.


Dennis Sosnoski wrote:
> Namespace handling is an especially messy issue for developers, judging
> from the number of times this misunderstanding occurs with all the
> document models. The problem is that XML defines each element as having
> a definite namespace (even if it's the "no namespace" namespace), but
> from a programmer's point of view it's more natural to see things in
> terms of namespace inheritance through the tree structure - an element
> either has an explicit namespace denoted by a prefix or default
> namespace definition, or is in the default namespace defined by an ancestor.
> If JDOM's goal is ease of use it seems like matching the programmer's
> POV rather than the XML POV would be the right way to go. What this
> would probably mean is that elements created without a specified
> namespace would just inherit the default namespace determined by where
> they were linked into the tree. The namespace could still be set
> explicitly if desired, and it'd be easy enough to extract and set the
> namespace when removing an element (and children) from a tree, again if
> desired.
> I think this has been discussed before. The fact that it keeps popping
> up as a source of confusion for users says that the current scheme
> (which is the same as DOM, dom4j, and all the other document models)
> doesn't work well for programmers.
>   - Dennis
> Li Xu wrote:
> >Bob and Ken
> >
> >Thank you!!! You answered my vague question clearly here.
> >
> >I thought when I assign a namespace using setNamespace() in an element, all its existing children will "by default" get it if they don't have a NS yet. Ken hit my nail in the head that I was using the string representation logic to assume the inheritance among the actual java objects.
> >
> >Cheers all!
> >LX
> >_______________________________________________
> >To control your jdom-interest membership:
> >http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
> >
> >
> >
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

More information about the jdom-interest mailing list