[jdom-interest] Reading the xml:base attribute

Bradley S. Huffman hip at a.cs.okstate.edu
Thu Jan 6 12:22:05 PST 2005

"Michael Kay" writes:

> > Currently, create a Namespace instance that maps a bogus 
> > prefix to the URI
> > 
> >     getAttribute(localName, Namespace.getNamespace("bogus", 
> > "someuri"));
> > 
> But this is where we started: the bogus prefix has to be "xml" if and only
> if the URI is the XML namespace - so I need conditional logic to allocate a
> valid bogus prefix, which then plays no part in the logic for finding the
> attribute.
> If that's what I have to do, so be it - but it seems a poor API design.

When all you want to do is search nodes, this is probably true. But I only
build JDOM nodes when I want to manipulate them and adding elements or 
attributes requires a instance of Namespace which I usually pre-allocate with
the prefix I prefer. So this situation does bother me. I already have a
instance of Namespace I can use.


More information about the jdom-interest mailing list