title: Exclude certain elements with an xpath query
body: <p>I'm using XPath to extract certain elements from the following URL:</p>
  
  <p><a href="http://gizmodo.com/how-often-cities-appear-in-books-from-the-past-200-year-1040700553" rel="nofollow">http://gizmodo.com/how-often-cities-appear-in-books-from-the-past-200-year-1040700553</a></p>
  
  <p>To extract the main content, I'm using the query:</p>
  
  <pre><code>//p[@class='has-media media-640']
  </code></pre>
  
  <p>However, I'd like to exclude all spans from within this main content that have the class "magnifier lightBox".  I've looked through StackOverflow and tried all sorts of methods such as:</p>
  
  <pre><code>//div[@class='row post-content']/*[not(self::span[@class='magnifier lightBox'])]
  </code></pre>
  
  <p>to no avail. </p>