[jdom-interest] Problem with namespace prefixes

Per Spilling Per.Spilling at objectware.no
Sat Jan 27 03:15:55 PST 2001


I have recently started to use JDOM to implement a Java/XML databinding
module to be used to implement ebXML-like messaging functionality for a
J2EE framework. This databinding module is based on the articles written
by Brett McLaughlin on this subject.

Currently I'm struggling somewhat to handle namespaces when
unmarshalling an XML instance document. Here is a small example of what
it can look like:

<?xml version="1.0" encoding="ISO-8859-1"?>

  <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.

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. 

Is this a bug in JDOM or are namespace prefixes not yet implemented?
Any suggestions how I can work around this problem?


Per Spilling, <per.spilling at objectware.no>
Principal consultant, Objectware AS.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20010127/69fc08e0/attachment.htm

More information about the jdom-interest mailing list