[jdom-interest] Is JDOM dying?

Robert (Jamie) Munro rjmunro at arjam.net
Mon Mar 17 10:42:01 PST 2003


> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of Malachi de AElfweald
> Sent: 14 March 2003 05:01
> To: Jason Hunter
> Cc: Kevin.Bedell at sunlife.com; JDOM
> Subject: Re: [jdom-interest] Is JDOM dying?
>
>
> Well, I am creating schemas anyways, so that I can validate the
> XML - which
> I never got to work with JDOM (though without JDOM it worked).
>
> As far as the namespace stuff... it is just really annoying to have to
> add it for every single element... a lot of my applications pass Element's
> around -- and the classes handle that specific element, without any
> namespace
> knowledge...  For example, I implemented a JFileChooser that
> handles remote
> filesystems (windows or unix)... They serialize the filesets, without any
> knowledge of what enclosing tags they will be embedded in.  Most of the
> time,
> things like that are in a common routine, and the one actually
> sending/receiving
> the XML are in an application-specific handler... As such, two or three
> different
> classes may wrap it differently....

To me, that sounds like a misuse of namespaces. An element called <foo>
in namespace X has no relationship to an element called <foo> in
namespace Y. If they are in effect interchangeable, (they can be written
by the same piece of code), they should have been in the same
namespace to start with.

The point of namespaces AFAICS is that if you have an <a> tag, it is
only a link if it is in the xhtml namespace. In another namespace it isn't a
link, it's a random tag. JDOM works well with this philosophy.

The problem is actually the textual representation of XML, and in particular
the concept of a default namespace. If you take a bunch of textual XML from
the middle of a document with a default namespace set, into another document
with a different default namespace set, you have changed the meaning of that
XML. If it happens to be valid in the other namespace, that is a
coincidence, and also a waste of namespaces. The problem is that because of
the way default namespaces inherit in textual XML, it is more convenient to
create another tag the same in another namespace than it is to reuse the tag
from the first namespace in all your documents.

Robert Munro

Ps. I know the real solution is for the person to write code that iterates
over their document and replaces Could there be a solution along the lines
of JDOM objects not having namespaces, but references to them. Then you
could change the reference, and all the parts of the document would change
namespaces together. Analogous to changing URI in a <x xmlns:foo='[URI]'>
type of tag will change the namespace of all the foo: tags in the whole
document.




More information about the jdom-interest mailing list