XML parsing and writing

Jim jhefferon at smcvt.edu
Tue Aug 1 19:44:41 EDT 2006


c00i90wn wrote:
On first write of the xml everything goes
> as it should but on subsequent writes it starts to add more and more
> unneeded newlines to it making it hard to read and ugly.
Pretty make it pretty by putting in newlines (and spaces) that are not
in the original data.  That is, if you have text "John Smith"
associated with the element <name> then pretty gives you something like

  <name>
    John Smith
  </name>
here with an extra two newlines and some whitespace indentation.  (I
don't recall 100% when it puts in stuff, but the point of pretty is to
put in extra stuff.)  You need to strip out the extra stuff (or print
it out not pretty; can you get a viewer that buffs-up a notbuff file so
you are seeing pretty but the data isn't actually pretty?).

Jim




More information about the Python-list mailing list