Problems with ElementTree and ProcessingInstruction

Kent Tenney ktenney at gmail.com
Sun Jan 28 21:23:20 EST 2007



On Jan 28, 7:46 pm, Gabriel Genellina <gagsl... at yahoo.com.ar> wrote:
> 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?>
> ><leo_file>stuff</leo_file>
>
> >How should I be doing this?open("filename","w").write('<?xml version="1.0" encoding="utf-8"?>\n'
>          '<?xml-stylesheet mystyle?>\n'
>          '<leo_file>stuff</leo_file>\n')

Right.

I can use ElementTree.write('filename')  and
prepend the instructions to the resulting file.

It leaves me curious as to the purpose/usage of 
ProcessingInstruction()

Thanks,
Kent


>
> :)
>
> >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!http://www.yahoo.com.ar/respuestas




More information about the Python-list mailing list