<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Windows-1252">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.4417.0">
<TITLE>Problem with namespace prefixes</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Hi,<BR>
<BR>
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.<BR>
<BR>
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:<BR>
<BR>
------------------<BR>
<?xml version="1.0" encoding="ISO-8859-1"?><BR>
<KWS02<BR>
xmlns="<A HREF="http://www.kbank.no/xml/1.0/kws02">http://www.kbank.no/xml/1.0/kws02</A>"<BR>
xmlns:xsd="<A HREF="http://www.w3.org/1999/XMLSchema">http://www.w3.org/1999/XMLSchema</A>"<BR>
xmlns:xsi="<A HREF="http://www.w3.org/1999/XMLSchema-instance">http://www.w3.org/1999/XMLSchema-instance</A>"<BR>
xmlns:cbktypes="<A HREF="http://www.kbank.no/xml/1.0/cbktypes">http://www.kbank.no/xml/1.0/cbktypes</A>"<BR>
xsi:schemaLocation="<A HREF="http://www.kbank.no/xml/1.0/kws02">http://www.kbank.no/xml/1.0/kws02</A><BR>
kws02.xsd<BR>
<A HREF="http://www.kbank.no/xml/1.0/cbktypes">http://www.kbank.no/xml/1.0/cbktypes</A><BR>
CbkTypes.xsd"><BR>
<BR>
<msgHeader xsi:type="cbktypes:MessageHeader"><BR>
...<BR>
------------------<BR>
<BR>
In this case I need to find the namespace for the 'cbktypes' prefix given in the 'msgHeader' element, and I therefore try to use<BR>
Namespace.getNamespace(String prefix, Element context)<BR>
to do this.<BR>
<BR>
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.<BR>
<BR>
Is this a bug in JDOM or are namespace prefixes not yet implemented?<BR>
Any suggestions how I can work around this problem?<BR>
<BR>
-Per<BR>
<BR>
--<BR>
Per Spilling, <per.spilling@objectware.no><BR>
Principal consultant, Objectware AS.<BR>
</FONT>
</P>
</BODY>
</HTML>