title: Using phantomjs to crawl a sitemap
body: <p>I am very new to phantomjs. I have been messing with the following for far too long. I know I am missing something very simple. I have the following sitemap.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" standalone="yes"?&gt;
  &lt;urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"&gt;
    &lt;url&gt;
      &lt;loc&gt;/&lt;/loc&gt;
      &lt;changefreq&gt;always&lt;/changefreq&gt;
      &lt;priority&gt;1.0&lt;/priority&gt;
    &lt;/url&gt;
    &lt;url&gt;
      &lt;loc&gt;/vehicles&lt;/loc&gt;
      &lt;lastmod&gt;2013-01-07&lt;/lastmod&gt;
    &lt;/url&gt;
  &lt;/urlset&gt;
  </code></pre>
  
  <p>Now all I am trying to do is use phantomjs to get the url values from the xml document. I have the following.</p>
  
  <pre><code>page.open("sitemap.xml", function(status) {
      if(status !== "success") {
          console.log("Unable to open sitemap.");
      } else {
          // Stuck here
          console.log(page.content);
      }
  });
  </code></pre>
  
  <p>The contents of the xml file are printed to screen correctly, but how do I use the document now to play with the xml? I just need to be able to get the first child of each url node. I have tried parsing the xml document into a DOMParser, but that does not seem right. Your help will be much appreciated.</p>
  
  <p>Also how do you debug phatomjs so I can see the object in its full glory? For example, If I console.log an object in Dev Tools, I can expand it and see the key - value pairs. I am guessing terminal does not offer this luxury?</p>