sorry for my english thanks again for your answer ;)
i did that .... o = open("output.txt","w") data = open(filename).read() o.write( re.sub('&(?!amp;|quot;|nbsp;|gt;|lt;|laquo;| raquo;|copy;|reg;|bul;|rsquo;)', '&', data) ) o.close() shutil.move ("output.txt",filename) xml = etree.parse(filename) xml = ET.parse(filename) it's dirty but works On 27 oct, 09:36, Stefan Behnel <stefan...@behnel.de> wrote: > Toff, 27.10.2009 09:15: > > > > > On 27 oct, 09:03, Christian Heimes <li...@cheimes.de> wrote: > >> Toff wrote: > >>> hello > >>> i can't parse a file with lxml > >>> ================================================================ > >>> <?xml version="1.0" encoding="iso-8859-1" ?> > >>> <packages> > >>> <package id="firefox" name="FireFox 3.5" > > >>> <download url="http://download.mozilla.org/? > >>> product=firefox-3.5&os=win&lang=fr" /> > >>> </package> > >>> </packages> > >>> ========================================================================= > >>> i know that & is a special caracter in xml > >> Because & has a special meaning in XML you have to quote a literal & as > >> & > > > but does my download url still allways works with & replace by $amp; > > In case you want to know if the URL keeps working if you replace '&' by > '&' in your XML file, then the answer is that it will actually /start/ > working that way, because it will not work the way you show above. An XML > parser will return the URL as expected. > > Note that it's also best to use an XML toolkit to actually generate XML, in > case you wrote the above file programmatically. > > Stefan -- http://mail.python.org/mailman/listinfo/python-list