no line breaks in xml file with elementTree

H

hackingKK

Hello all.
I want to know if there is a way to have the ElementTree module write to
an xml file with line breaks?
I find that when I use the write function from the module on a tree
object, the resulting file has no line breaks. I don't want to use
prittyprint because it is adding extra tabs to the file and they are
either counted as extra nodes or in case of element.text with
elementtree, they are rendered as a part of the text, both being
impractical results.
So is there a middle approach where we can have some thing similar to
prityprint but without the extra tabs and yet having a properly line
breaked xml file?
Further more, I just was curious why elementtree is not having the
namespace facility?
xml.dom.minidom has a way to generate tags with namespaces.
Any thing similar in elementTree?

happy hacking.
Krishnakant.
 
L

Lawrence D'Oliveiro

hackingKK said:
I want to know if there is a way to have the ElementTree module write to
an xml file with line breaks?

Why does it matter? The XML files you generate are not for humans to look
at, are they?
Further more, I just was curious why elementtree is not having the
namespace facility?

ElementTree handles namespaces just fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top