title: how to extract html content using xpath using nodejs module
body: <p>I am looking for html content extractor using xpath, I have seen various nodejs module for this like </p>
  
  <blockquote>
    <p><strong>jsdom, htmlparser2, xpath, cheerio</strong></p>
  </blockquote>
  
  <p>I found cheerio better for getting data using class, id, tags etc but I am not able to get data by specifying xpath , and by using xpath nodejs module I am able to get data using xpath for smaller html, for longer html it gives different type of error like </p>
  
  <blockquote>
    <p>entity not found:&nbsp;  @#[line:120,col:9], unclosed xml attribute
    @#[line:1,col:877]</p>
  </blockquote>
  
  <p>Note: I have no permission to change html in any way</p>
  
  <p>e.g. if my html is </p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
  &lt;div&gt;
  
      &lt;ul id="fruits"&gt;
          &lt;li class="apple"&gt;Apple&lt;/li&gt;
          &lt;li class="orange"&gt;Orange&lt;/li&gt;
          &lt;li class="pear"&gt;Pear&lt;/li&gt;
      &lt;/ul&gt;
  
  &lt;/div&gt;
  
  &lt;/body&gt;
  
  
  &lt;/html&gt;
  </code></pre>
  
  <p>if I am using this and giving this xpath <code>//*[@id="fruits"]/li[2]</code> to find element using xpath nodejs module, I am not getting any error and got the result as <strong>Orange</strong> using xpath nodejs module, but if I am using html of this page <a href="http://www.infotaxi.org/india_taxi/ahmedabad_taxi.htm" rel="nofollow">http://www.infotaxi.org/india_taxi/ahmedabad_taxi.htm</a></p>
  
  <p>(which is quite longer), and accessing the part of text using xpath</p>
  
  <pre><code>//*[@id="navlistmeniu"]/li[3]/a/b, 
  </code></pre>
  
  <p><strong>I am getting error</strong></p>
  
  <blockquote>
    <p>entity not found:&nbsp; @#[line:120,col:9]</p>
  </blockquote>
  
  <p>Using Cheerio I am able to extract data using class, id, tags etc. and not with xpath</p>
  
  <p>Please help????</p>