Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python parse special character in lxml

in my xml I have this line

<url>http://www.modeluxproperties.com/?act=list_web&m=search&purpose=sale&project=&type=32&beds=&lop=&Submit.x=37&Submit.y=20</url>

when i do this:

self.doc=etree.parse(xmlFile)

I got this error in that line :

lxml.etree.XMLSyntaxError: EntityRef: expecting ';', line 5, column 56
like image 896
Marco Dinatsoli Avatar asked Aug 02 '26 12:08

Marco Dinatsoli


1 Answers

It's parsing the ampersands in the URL as XML entities. I think the ampersands should be URL encoded -- try replacing all & with &amp;

like image 125
Kasapo Avatar answered Aug 04 '26 03:08

Kasapo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!