Convert raw data to XML

elrondrules at gmail.com elrondrules at gmail.com
Tue Jan 30 03:42:07 CET 2007


Hi

I am running a HTTP server which receives post from a process.
In my do_POST method am receiving raw data.

I know that this raw data has a valid XML content and I need to 
convert this into an XML file.

Are there any routines to do this.. if not how to write one..

For example the raw data is as follows

<?xml version="1.0" ?><Blah><ABC><Id id="1"/><Description>SomeText </
Description><Result>PassorFail</Result></ABC></Blah>

without spaces or new lines. I need this to be written into an XML 
file as

<?xml version="1.0" ?>
<Blah>
       <ABC>
              <Id id="1"/>
              <Description>
                         SomeText
              </Description>
              <Result>
                         PassorFail
              </Result>
      </ABC>
</Blah>

The tags in the raw data are not the same alaways.. Hence I need a 
generic routine that does the trick

Any pointers for this issue would help

Thanks




More information about the Python-list mailing list