Howto write XML file with comments?
Alexander Eisenhuth
newsuser at stacom-software.de
Thu Jul 8 06:07:16 EDT 2010
Stefan Behnel schrieb:
> Alexander Eisenhuth, 08.07.2010 11:08:
>> - I've to write a XML document including comments
>
> "write" in the sense of typing in a text editor? Or constructing one
> programmatically in memory? Or ... ?
write means write to a file
>
> And what kind of data from what kind of source do you want to put into
> the document?
Data is present as tags and attributes
>
> All of that has an impact on the 'right' answer.
>
>
>> - the document should be formatted that it could be viewed with a text
>> editor
>>
>> What is the fastest (time for realization) approach doing it in python
>> 2.5?
>
> If you mean to build an XML document programmatically, potentially using
> data that you get from somewhere, take a look at cElementTree. There's
> also a short recipe for pretty printing the tree before writing it out.
Is the API of cElementTree different from ElementTree in the python standard
library?
>
> Stefan
>
More information about the Python-list
mailing list