[jdom-interest] DOMOutputter attribute/namespace problem.

Spindizzy - The Dizzy Wizard spindizzy_wizard at yahoo.com
Mon Apr 12 16:33:01 PDT 2004


I looked through the 'interest' list, and noticed that a number of
people commented that various namespace fixes needed to be applied to
DOMOutputter, as well as to whichever class they were working on at
that time.

Unfortunately, it looks like this has slid through the cracks.

If you look at DOMOutputter.java (which I got from CVS in the last hour
or so), at line 307 a check is made to see if the attribute namespace
is the same as the element namespace.  If it isn't, the attribute
namespace is added regardless of what namespaces are presently in
scope.

If no one else is already dealing with this, let me know, and I'll take
a swing at it, although I'm likely to only fix the one problem.  Little
time, lotsa work, and this is the only one I know of for certain.

A few more details:

<?xml version="1.0"?>
<test xmlns="http://foo/test" xmlns:bar="http://bar/test">
<bar:embedded bar:ID="1">
<bar:type bar:value="alpha"/>
<otherobject bar:value="beta"/>
<otherprop>propvalue</otherprop>
</bar:embedded>
</test>

When pushed through DOMOutputter, and then serialized (don't ask why),
you get the following:

<?xml version="1.0"?>
<test xmlns="http://foo/test" xmlns:bar="http://bar/test">
<bar:embedded bar:ID="1">
<bar:type bar:value="alpha"/>
<otherobject bar:value="beta" xmlns:bar="http://bar/test"/>
<otherprop>propvalue</otherprop>
</bar:embedded>
</test>

Notice the extra namespace declaration on 'otherobject'?


=====
Spindizzy, the Dizzy Wizard
(spindizzy_wizard at yahoo.com)

__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html



More information about the jdom-interest mailing list