title: How do I use a default namespace in an lxml xpath query?
body: <p>I have an xml document in the following format:</p>
  
  <pre><code>&lt;feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:gsa="http://schemas.google.com/gsa/2007"&gt;
    ...
    &lt;entry&gt;
      &lt;id&gt;https://ip.ad.dr.ess:8000/feeds/diagnostics/smb://ip.ad.dr.ess/path/to/file&lt;/id&gt;
      &lt;updated&gt;2011-11-07T21:32:39.795Z&lt;/updated&gt;
      &lt;app:edited xmlns:app="http://purl.org/atom/app#"&gt;2011-11-07T21:32:39.795Z&lt;/app:edited&gt;
      &lt;link rel="self" type="application/atom+xml" href="https://ip.ad.dr.ess:8000/feeds/diagnostics"/&gt;
      &lt;link rel="edit" type="application/atom+xml" href="https://ip.ad.dr.ess:8000/feeds/diagnostics"/&gt;
      &lt;gsa:content name="entryID"&gt;smb://ip.ad.dr.ess/path/to/directory&lt;/gsa:content&gt;
      &lt;gsa:content name="numCrawledURLs"&gt;7&lt;/gsa:content&gt;
      &lt;gsa:content name="numExcludedURLs"&gt;0&lt;/gsa:content&gt;
      &lt;gsa:content name="type"&gt;DirectoryContentData&lt;/gsa:content&gt;
      &lt;gsa:content name="numRetrievalErrors"&gt;0&lt;/gsa:content&gt;
    &lt;/entry&gt;
    &lt;entry&gt;
      ...
    &lt;/entry&gt;
    ...
  &lt;/feed&gt;
  </code></pre>
  
  <p>I need to retrieve all <code>entry</code> elements using xpath in lxml.  My problem is that I can't figure out how to use an empty namespace.  I have tried the following examples, but none work.  Please advise.</p>
  
  <pre><code>import lxml.etree as et
  
  tree=et.fromstring(xml)    
  </code></pre>
  
  <p>The various things I have tried are:</p>
  
  <pre><code>for node in tree.xpath('//entry'):
  </code></pre>
  
  <p>or</p>
  
  <pre><code>namespaces = {None:"http://www.w3.org/2005/Atom" ,"openSearch":"http://a9.com/-/spec/opensearchrss/1.0/" ,"gsa":"http://schemas.google.com/gsa/2007"}
  
  for node in tree.xpath('//entry', namespaces=ns):
  </code></pre>
  
  <p>or</p>
  
  <pre><code>for node in tree.xpath('//\"{http://www.w3.org/2005/Atom}entry\"'):
  </code></pre>
  
  <p>At this point I just don't know what to try.  Any help is greatly appreciated.</p>