title: PHP XML file filter on match
body: <p>I am having a heck of a time getting this working...</p>
  
  <p>What I want to do is filter a xml file by a city (or market in this case).</p>
  
  <p>This is the xml data.</p>
  
  <pre><code>&lt;itemset&gt;
  &lt;item&gt;
  &lt;id&gt;2171&lt;/id&gt;
  &lt;market&gt;Vancouver&lt;/market&gt;
  &lt;url&gt;http://&lt;/url&gt;&lt;/item&gt;
  &lt;item&gt;
  &lt;id&gt;2172&lt;/id&gt;
  &lt;market&gt;Toronto&lt;/market&gt;
  &lt;url&gt;http://&lt;/url&gt;&lt;/item&gt;
  &lt;item&gt;
  &lt;id&gt;2171&lt;/id&gt;
  &lt;market&gt;Vancouver&lt;/market&gt;
  &lt;url&gt;http://&lt;/url&gt;&lt;/item&gt;
  </code></pre>
  
  <p>This is my code...</p>
  
  <pre><code>&lt;?php
  $source = 'get-xml-feed.php.xml';
  
  $xml = new SimpleXMLElement($source);
  
  $result = $xml-&gt;xpath('//item/[contains(market, \'Toronto\')]');
  
  while(list( , $node) = each($result)) {
      echo '//Item/[contains(Market, \'Toronto\')]',$node,"\n";
  }
  
  ?&gt;
  </code></pre>
  
  <p>If I can get this working I would like to access each element, item[0], item[1] base on filtered results.</p>
  
  <p>Thanks</p>