[jdom-interest] RE: Bug in SAXOutputter

Laurent Bihanic laurent.bihanic at atosorigin.com
Thu Apr 22 07:59:59 PDT 2004


Hi,

PJ Fanning wrote:
> I recently submitted a patch for the SAXOutputter to the list. This class
> does not handle the case where qualified elements have unqualified elements
> for children correctly. I was wondering if this patch might be included in
> the next version of JDOM and when this was likely to be released.

I was able to reproduce the problem but I'm puzzled by your patch.
I don't understand the special case for NO_NAMESPACE :
             if (ns == Namespace.NO_NAMESPACE) {
                 String uri = namespaces.getURI(ns.getPrefix());
                 if(uri != null && uri.length() > 0)
                     add = true;
             }

IMHO, simple changing
         if (ns != Namespace.NO_NAMESPACE && ns != Namespace.XML_NAMESPACE) {
to
         if (ns != Namespace.XML_NAMESPACE) {
seems to be fine.
The URI for NO_NAMESPACE being hardcoded to "", the general test
             if (!ns.getURI().equals(uri)) {
is correct and won't lead to a NullPointerException.

What do you think?

Laurent



More information about the jdom-interest mailing list