title: PHP - parse webpage using SimpleXMLElement
body: <p>I have this webpage I'm trying to parse using SimpleXMLElement to look for a#href "#3" and then get the content of the following span->a which would be "jim":</p>
  
  <pre><code>&lt;?xml version='1.0'?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
      &lt;head&gt;..&lt;/head&gt;
      &lt;title&gt;this is the title&lt;title&gt;
      &lt;body&gt;
        &lt;script&gt;...&lt;/script&gt;
        &lt;div id="div1"&gt;
          something
        &lt;/div&gt;
        &lt;div id="content"&gt;
          &lt;div id="src"&gt;
              &lt;pre&gt;
                  &lt;a name="1" href="#1"&gt;1&lt;/a&gt;
                  &lt;span class="myclass"&gt;
                      &lt;a href="somelink123"&gt;john&lt;/a&gt;
                  &lt;/span&gt;
                  &lt;a name="1" href="#2"&gt;2&lt;/a&gt;
                  &lt;span class="myclass"&gt;
                      &lt;a href="somelink2342"&gt;dev&lt;/a&gt;
                  &lt;/span&gt;
                  &lt;a name="1" href="#3"&gt;3&lt;/a&gt;
                  &lt;span class="myclass"&gt;
                      &lt;a href="somelink33452"&gt;jim&lt;/a&gt;
                  &lt;/span&gt;
                  ....
                  ....
              &lt;/pre&gt;
          &lt;/div&gt;
        &lt;/div&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I'm using SimpleXMLElement to get to the children of 'pre' but how would I access elements based on the attributes and then the siblings?</p>
  
  <p>Thanks!</p>