lxml xpath in python, how to handle missing tags?

NathanG

New Member
suppose I want to parse with an lxml xpath expression the folowing xml\[code\]<pack xmlns="http://ns.qubic.tv/2010/item"> <packitem> <duration>520</duration> <max_count>14</max_count> </packitem> <packitem> <duration>12</duration> </packitem></pack>\[/code\]which is a variation of what can be found at http://python-thoughts.blogspot.fr/2012/01/default-value-for-text-function-using.htmlHow can I achieve a parsing of the different elements that would give me once zipped (in the zip or izip python function sense)[(520,14),(12,None)]?The missing duration tag in the second packitem holds me back from getting what i want.
 
Back
Top