title: How to make XPath return 'None' in Python if no data found?
body: <p>XPath returns nothing if a child element has no text value. In this case, rating has no data, so I want it to say so - None or nothing in this child instead of just ignoring it. Your input is much appreciated.</p>
  
  <p><strong>XML :</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  
  &lt;bookstore&gt;
  
  &lt;book&gt;  
    &lt;title lang="eng"&gt;Harry Potter&lt;/title&gt;
    &lt;price&gt;29.99&lt;/price&gt;
    &lt;rating&gt;&lt;/rating&gt;
  &lt;/book&gt;
  
  &lt;book&gt;
    &lt;title lang="hindi"&gt;Learning XML&lt;/title&gt;
    &lt;price&gt;39.95&lt;/price&gt;
    &lt;rating&gt;&lt;/rating&gt;
  &lt;/book&gt;
  
  &lt;/bookstore&gt;
  </code></pre>
  
  <p><strong>Python :</strong></p>
  
  <pre><code>&gt;&gt;&gt; import lxml.html as lh
  &gt;&gt;&gt; bk=open('book.xml','r')
  &gt;&gt;&gt; bkout=lh.parse(bk)
  &gt;&gt;&gt; bk.close()
  &gt;&gt;&gt; bkout.xpath('//book/*/text()')
  ['Harry Potter', '29.99', 'Learning XML', '39.95']
  
  &gt;&gt;&gt; bkout.xpath('//book/* and not(text())/text()')
  True
  </code></pre>
  
  <p><strong>Desired Output :</strong></p>
  
  <pre><code>['Harry Potter', '29.99', '', 'Learning XML', '39.95', '']
  or
  ['Harry Potter', '29.99', None, 'Learning XML', '39.95', None]
  </code></pre>