Reading text from XML nodes using Python's libxml2

aromatic

New Member
I am a first time \[code\]XPath\[/code\] user and need to be able to get the text values of these different elements.. for instance \[code\]time\[/code\], \[code\]title\[/code\], etc.. I am using the \[code\]libxml2\[/code\] module in Python and so far have not had much luck getting just the values of the text I need. The code below here only returns the element tags.. i need the values.. any help would be GREATLY appreciated!I'm using this code:\[code\]doc = libxml2.parseDoc(xmlOutput)result = doc.xpathEval('//*')\[/code\]With the following document:\[code\]<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE SCAN_LIST_OUTPUT SYSTEM "https://qualysapi.qualys.com/api/2.0/fo/sca/scan_list_output.dtd"><SCAN_LIST_OUTPUT><RESPONSE><DATETIME>2012-01-22T01:21:53Z</DATETIME><SCAN_LIST> <SCAN> <REF>scan/2343423</REF> <TYPE>Scheduled</TYPE> <TITLE><![CDATA[customer 1 5/20/2012]]></TITLE> <USER_LOGIN>user1</USER_LOGIN> <LAUNCH_DATETIME>2012-02-21T04:11:05Z</LAUNCH_DATETIME> <STATUS> <STATE>Finished</STATE> </STATUS> <TARGET><![CDATA[13.3.3.2, 13.8.8.10, 13.10.12.60, 13.10.12.11...]]></TARGET> </SCAN></SCAN_LIST></RESPONSE></SCAN_LIST_OUTPUT>\[/code\]
 
Back
Top