how to print newline in xml?

anatoli.barski at googlemail.com anatoli.barski at googlemail.com
Wed May 31 00:14:12 CEST 2006


I currently use xml.dom.minidom and ext to create a dom-tree which I
would write to an xml-file.
My intention is to create something like this:

<Robot>  <!-- armar3 -->
  <Joint>
  </Joint>

  <Joint>
  </Joint>
</Robot>

but I didn't find any possibility either to put comment directly behind
a tag nor did I found how to put a new line like in example between the
two joints. The reason why I'm trying to achieve this: the file should
be easy to read for a human...

now I can just print the upper document like this:

<!-- armar3 -->
<Robot>
  <Joint>
  </Joint>
  <Joint>
  </Joint>
</Robot>

which is already not very readable - but it becomes even worse along
with increasing number of comments




More information about the Python-list mailing list