https://issues.apache.org/bugzilla/show_bug.cgi?id=47353





--- Comment #6 from Scott Cantor <canto...@osu.edu>  2009-06-13 13:12:19 PST ---
After trying to understand the code, you're definitely correct that the fix
isn't going to be just removing the check inside the printNamespace method.

My reading of the algorithm is that there's a very complex set of interactions
between the namespace stack and the logic to handle default namespaces. The
point of the stack is return the set of "in scope" namespaces that haven't been
printed yet. The isDefault flag is used to ensure that the default namespace in
scope is always returned by the stack, even if it's actually been printed.

That in turn causes the stack-based output logic to see a non-empty default
declaration and set the xmlnsFound flag to true, which then *prevents* the code
down below that might output xmlns="" from running.

Altering the printNamespace logic causes it to skip the default namespace
declaration in the stack, never returning it, which then skips the code that
notices it's in scope. At that point the xmlns="" logic runs, and because it
finds the non-empty default declaration up above in the tree, it outputs
xmlns="", which obviously is incorrect.

Without a total overhaul, I would have to assume that your original patch is
closer to the mark, even though I have no way to know what interactions that
might cause.

Alternatively, something would need to be added to the stack interface to allow
the xmlns="" logic to use it even if the first/next methods don't return the
default declaration, which would in turn fix the extra printing you're seeing.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to