[Tutor] Schema change in ElementTree

Benjamin Serrato benjamin.serrato at gmail.com
Mon Aug 16 05:51:39 CEST 2010


Hi guys, thanks for you help in the past.  I had my first occasion to write
a useful script recently editing the contents of an xml file.  It was pretty
simple, but I have two problems which I know have to take care of by opening
in Notepad++ and changing manually.

1. The file output has LF not CRLF as the newline character.  I'm not sure
if this matters, but this is on windows and I'm having trouble reimporting
this file back into the program it belongs to.  I'd like to change how it
outputs newlines, or use python to automatically fix the .xml file.
2.  Before parsing the file 'xs' is the schema prefix, but after writing
'ns0' is the schema prefix (e.g. <xs:schema ...> to <ns0:schema ...>), but
this doesn't carry over to the attributes so I'm left with (...
types="xs:int").  That doesn't make any sense.  I've the documentation at
effbot, but didn't see anything outright I needed to redefine the schema
before writing to disk.  Also, is it possible to define the order of the
schema attributes?

dpaste of the code for the curious: http://dpaste.de/Eebo/

Benjamin Serrato
682.472.8650
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100815/6c1fea25/attachment.html>


More information about the Tutor mailing list