[jdom-interest] Problem with namespace prefixes

Jason Hunter jhunter at collab.net
Sat Jan 27 22:02:09 PST 2001


> <msgHeader xsi:type="cbktypes:MessageHeader">
> ...
> In this case I need to find the namespace for the 'cbktypes' prefix
> given in the 'msgHeader' element, and I therefore try to use
>   Namespace.getNamespace(String prefix, Element context)
> to do this.

Try msgHeader.getNamespace("ckbtypes");

> This method recurses up to the root element, but then it turns out
> that it cannot find any of the the 'xmlns:...' attributes, even though
> they are declared in the XML instance messages.

The call you made should have worked.  Only problem: I didn't realize it
existed and didn't keep it updated.  :-)  I'm going to mark the
Namespace static method deprecated (to be removed after the next beta)
because it's duplicate functionality to the Element instance method
which I think is a more elegant approach.

-jh-



More information about the jdom-interest mailing list