Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

Re: [jdom-interest] RE: Bug in SAXOutputter

Laurent Bihanic

2004-04-22

Replies:


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
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.