title: how to get the full contents of a node using xpath & lxml?
body: <p>I am using lxml's xpath function to retrieve parts of a webpage. I am trying to get contents of a <code>&lt;font&gt;</code> tag, which includes html tags of its own. If I use</p>
  
  <pre><code>//td[@valign="top"]/p[1]/font[@face="verdana" and @color="#ffffff" and @size="2"]
  </code></pre>
  
  <p>I get the right amount of nodes, but they are returned as lxml objects (<code>&lt;Element font at 0x101fe5eb0&gt;</code>).</p>
  
  <p>If I use</p>
  
  <pre><code>//td[@valign="top"]/p[1]/font[@face="verdana" and @color="#ffffff" and @size="2"]/text()
  </code></pre>
  
  <p>I get exactly what I want, except that I don't get any of the HTML code which is contained within the <code>&lt;font&gt;</code> nodes.</p>
  
  <p>If I use</p>
  
  <pre><code>//td[@valign="top"]/p[1]/font[@face="verdana" and @color="#ffffff" and @size="2"]/node()
  </code></pre>
  
  <p>if get a mixture of text and lxml elements! (e.g. <code>something something &lt;Element a at 0x102ac2140&gt; something</code>)</p>
  
  <p>Is there anyway to use a pure XPath query to get the contents of the <code>&lt;font&gt;</code> nodes, or even to force lxml to return a string of the contents from the <code>.xpath()</code> method, rather than an lxml object?</p>
  
  <p>Note that I'm returning a list of many nodes from the XPath query so the solution needs to support that.</p>
  
  <p>just to clarify... i want to return <code>something something &lt;a href="url"&gt;inside&lt;/a&gt; something</code> from something like...</p>
  
  <pre><code>&lt;font face="verdana" color="#ffffff" size="2"&gt;&lt;a href="url"&gt;inside&lt;/a&gt; something&lt;/font&gt;
  </code></pre>