title: node js cheerio xml
body: <p>I have the below code and it is working fine to get:</p>
  
  <pre><code>&lt;troveUrl&gt;http://trove.nla.gov.au/work/23043869&lt;/troveUrl&gt; 
  </code></pre>
  
  <p>But I would like to get the value after 'id' in the following from the same page and cannot get it!</p>
  
  <pre><code>&lt;work id="23043869" url="/work/23043869"&gt;
  </code></pre>
  
  <p>here is the code that i currently have </p>
  
  <pre><code>var request = require ('request'),
      cheerio = require ('cheerio');
      request('http://api.trove.nla.gov.au/result?key=6k6oagt6ott4ohno&amp;zone=book&amp;q-year1-date=2000&amp;l-advformat=Thesis&amp;l-australian=y&amp;q-term2=&amp;q-term3=&amp;q-term0=&amp;q-field1=title%3A&amp;q-type2=all&amp;q-field0=&amp;q-term1=&amp;q-type3=all&amp;q-field3=subject%3A&amp;q-type0=all&amp;q-field2=creator%3A&amp;q-type1=all&amp;l-availability=y%2Ff&amp;q=+date%3A[2000+TO+2014]&amp;q-year2-date=2014&amp;n=1', function (error, response, html) {
        if (!error &amp;&amp; response.statusCode == 200) {
          var $ = cheerio.load(html);
          $('troveurl').each(function(i, element){
            var id = $(this);
            console.log(id.text());
          });
        }
      });
  </code></pre>
  
  <p>Any assistance appreciated.</p>