XML error object has no attribute 'cssselect'

luisr320

New Member
the following does not appear to parse the xml data correctly or is doing something wrong.This is the code being run.from lxml import etree from lxml.etree import fromstring\[code\]if request.POST: xml = request.POST['xml'].encode('utf-8') parser = etree.XMLParser(ns_clean=True, recover=True, encoding='utf-8') h = fromstring(xml, parser=parser) status = h.cssselect('itagg_delivery_receipt status').text_content() return HttpResponse(status)\[/code\]The error:AttributeError: 'lxml.etree._Element' object has no attribute 'cssselect' statusThis is the xml document that is being sent:\[code\] <?xml version="1.1" encoding="ISO-8859-1"?><itagg_delivery_receipt><version>1.0</version><msisdn>447889000000</msisdn><submission_ref>845tgrgsehg394g3hdfhhh56445y7ts6</submission_ref><status>Delivered</status><reason>4</reason><timestamp>20050709120945</timestamp><retry>0</retry></itagg_delivery_receipt> \[/code\]I have dumped out str(h) and it looks like this \[code\]<element 0x7fd341e93870="" at="" itagg_delivery_receipt=""></element>\[/code\]
 
Top