[Tutor] Generating XML using Python

Peter Otten __peter__ at web.de
Mon Apr 11 09:47:54 CEST 2011


tee chwee liong wrote:

> i'm using python to generate xml with elementtree api. and i'm getting
> error when opening the output xml. it doesnt give error when running. i
> also tried to use python to output to a text file and it works without any
> error. Pls advise me how i can rectify the error when opening the output
> xml. attached is my code, output in text file and output in xml.

>     title = ET.SubElement(head1, "Target Speed") 

Did you forget to replace the blank between Target and Speed with an 
underscore? It looks like ElementTree doesn't validate the Element tag.
  
> p/s: i sent earlier email but got bounced email so sending out again.

I see them both.



More information about the Tutor mailing list