DOMOutputter attribute/namespace problem. 2004-04-12 - By Spindizzy - The Dizzy Wizard
Back 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@(protected))
__ ____ ____ ____ ____ ____ ______ Do you Yahoo!? Yahoo! Tax Center - File online by April 15th http://taxes.yahoo.com/filing.html __ ____ ____ ____ ____ ____ ____ ____ ____ ____ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected) .com
|
|