Hi,

I have an XML file in a single long string. How can I convert it into
the nicely indented format as displayed by Internet Explorer using
Python?

Thanks,
Laguna

Input XML file (one continuous string without newline):

<!-- $Revision: 12 $ --> <!-- $Date: 12/13/04 5:13p $ --> <control>
<schedule> <minute>*/2</minute> <hour>*</hour>
<day_of_month>*</day_of_month> <month>*</month>
<day_of_week>*</day_of_week> </schedule> </control>

Output XML file:

  <!--  $Revision: 12 $   -->
  <!--  $Date: 12/13/04 5:13p $   -->
  <control>
        <schedule>
                <minute>*/2</minute>
                <hour>*</hour>
                <day_of_month>*</day_of_month>
                <month>*</month>
                <day_of_week>*</day_of_week> 
        </schedule>
  </control>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to