Python and XPath

egwabor

New Member
I'm trying to parse this XMLI want to get a list of all of the mechanisms, so I'm trying to use XPATH (please suggest if theres an easier way) to get the mechanisms... Here is my code:\[code\]parseMessage = libxml2.parseDoc(doc)xpathcon = parseMessage.xpathNewContext()xpathcon.xpathRegisterNs('urn','http://etherx.jabber.org/streams')nodes = xpathcon.xpathEval("//urn:text()")print nodes\[/code\]And here is the error I'm getting... \[code\]Entity: line 1: parser error : Premature end of data in tag stream line 1 h"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>\[/code\]I know that my code doesn't remove all the mechanisms but first I'd just like to get around the issue at hand. Anyway to make this into correct XML that can be parsed? Do I need to add a new header or remove a header or do something else?
 
Back
Top