[jdom-interest] Bug in JDOMSource or maybe SAXoutputter.

Jason Hunter jhunter at collab.net
Sun Jun 10 15:23:49 PDT 2001


I just checked in Laurent's patch for this.  Ken, could you please
verify the latest code in CVS works OK for you now?

-jh-

Ken Rune Helland wrote:
> 
> Hello.
> 
> Found what I think is a bug in JDOMSource or maybe SAXoutputter
> used inside JDOMSource (and i downloed the daily sourcedrop 15
> minutes ago :-)  ).
> 
> when XSL transfoming from a JDOM Document object using JDOMSource
> a namespace declaraiton does not follow to the target. This namespace
> declaration is not for the element it is declared in but for a
> attribute used somewhere in the document.
> 
> I will try to find this bug, but SAX and XSL is not my
> strong point so if anyone who know this well can beat me to
> it i will appreciate it.
> 
> Currently i work aroud it using StreamSource since at this
> time in the program I have both the JDOM and serialized
> version of the xml-document but using JDOMSource cuts
> 30-60% of the transfomation time in my tests compared
> to StreamSource.
> 
> Best Regards
> KenR
> 
> A stripped down exsample showing the bug:
> 
> Source document:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <ROOT foo:bar="Foobar" xmlns:foo="http://www.foo.com" >
>         <ELEMENT foo:bar="barfoo">Text</ELEMENT>
> </ROOT>
> 
> Stylesheet:
> 
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>    <xsl:output method="xml" indent="yes"/>
> 
>    <xsl:template match="/">
>         <xsl:apply-templates/>
>    </xsl:template>
> 
>    <xsl:template match="ROOT">
>         <xsl:copy>
>                 <xsl:copy-of select ="@*"/>
>                 <xsl:apply-templates select ="ELEMENT" />
>         </xsl:copy>
>    </xsl:template>
> 
>    <xsl:template match="ELEMENT">
>         <xsl:copy>
>                 <xsl:copy-of select ="@*"/>
>                 <xsl:value-of select="." />
>         </xsl:copy>
>    </xsl:template>
> 
> </xsl:stylesheet>
> 
> Result using StreamSource (this is what I want):
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <ROOT xmlns:foo="http://www.foo.com" foo:bar="Foobar">
> <ELEMENT foo:bar="barfoo">Text</ELEMENT>
> </ROOT>
> 
> Result parsing into JDOM document and using JDOMSource:
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <ROOT foo:bar="Foobar">
> <ELEMENT foo:bar="barfoo">Text</ELEMENT>
> </ROOT>
> 
> The declaration on the "foo" prefix to the "http://www.foo.com"
> namespace is missing.
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list