Problems with ElementTree and ProcessingInstruction

Gabriel Genellina gagsl-py at
Mon Jan 29 02:46:39 CET 2007

At Sunday 28/1/2007 11:28, Kent  Tenney wrote:

>I want to generate the following file;
><?xml version="1.0" encoding="utf-8"?>
><?xml-stylesheet mystyle?>
>How should I be doing this?

open("filename","w").write('<?xml version="1.0" encoding="utf-8"?>\n'
         '<?xml-stylesheet mystyle?>\n'


>As far as I can tell, ElementTree() requires everything
>to be inside the root element (leo_file)

Just keep the first two lines on my example...

Gabriel Genellina
Softlab SRL 


Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 

More information about the Python-list mailing list