toprettyxml messes up with whitespaces

Jim jim.hefferon at
Wed Oct 3 14:03:05 CEST 2007

On Oct 3, 6:18 am, "Jorgen Bodde" <jorgen.maill... at> wrote:
> Should I file this as a bug to be solved? I have my workaround now,
> but I read online that more people seem to have ran into this.
Perhaps it is not a bug in that it does not violate the standard.  But
I know that I have been annoyed by it any number of times.  I think it
is fair to say that it violates the principle of least surprise.

IMHO "<action><p>Then a shot rang out.\nHe shouted.</p></action>"
should be pretty-printed as

  <p>Then a shot rang out.
He shouted.</p>

That is, I perceive that the "right" behavior is to not add white
space to the textual data.

No doubt this is a matter of taste and of intended audience (and maybe
there are complications that I don't see).  But let me urge you to
send the mataintainers something.

Jim Hefferon

More information about the Python-list mailing list