Tilman Linden wrote:

Am Di, den 06.07.2004 schrieb Dennis Sosnoski um 19:08:


Somehow the elements you're trying to marshal appear to have a namespace set. If you want to marshal them as though they were not in any namespace you can modify your own version of the DomElementMapper/DomMapperBase code to always use the nonamespace index (which will always be 0) when writing elements and attributes out. You can also go through the DOM tree and set the namespaces to null (I think it's null for DOM - you should check what the DOM docs say).




for testing purposes i printed out the namespace (uri/prefix) of all
elements which were passed to DomElementMapper.marshalElement... they
were all null. i think the problem is that with a "null" namespace
uri/prefix, DomElementMapper uses the namespace index -1, which causes
the error i described. looking at the method findNamespaceIndex in DomMapperBase, if my
uris/prefixes all would be "" (the empty string) i would get what i
wanted (index 0). i am not quite sure what to conclude. does the empty string mean no
namespace for DOM? or does the DomElementMapper misinterpret uri/prefix
set to null?


Tilman



I just checked the javadocs, and agree that null should be treated as equivalent to "" - it looks like null gets used if you create elements with the no-namespace form. I thought "" was also used to indicate the no-namespace namespace, but don't see any references offhand. Still, it's probably safest to make it work both ways.

That means that DomMapperBase.findNamespaceIndex() should be changed to treat a null URI as equivalent to "", and the first line should probably be changed from:

       if ("".equals(prefix) && "".equals(uri)) {

to
if (("".equals(prefix) || prefix == null) && ("".equals(uri) || uri == null)) {


 - Dennis



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to