title: Xpath nested tables
body: <p>I have a Table, see Code. Its a table that has a table in it, so its nested. Now i want to get all vales of the parent table only and then all values of the child table.</p>
  
  <p>To get the childs data i can do this:</p>
  
  <pre><code>$query = '//*[@id="WordClass"]/table[2]/tr/td[2]/table/tr';
  
  $nodes = $xpath-&gt;query($query);
  
  foreach ($nodes as $node) { //do more querys to get the td data and save it..
  </code></pre>
  
  <p>My problem is how to only get the data of the parent table without getting the child data/tr/td also.</p>
  
  <pre><code>&lt;table cellpadding="0" cellspacing="0" border="0"&gt;
  &lt;tbody&gt;
  &lt;tr valign="top"&gt;
      &lt;td&gt;
          &lt;table cellpadding="1" cellspacing="2" border="0"&gt;
              &lt;tr&gt;
                  &lt;td class="colTitle" align="center" colspan="4"&gt;
                      Da Titel
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="colTitle" align="center" colspan="2"&gt;One
                  &lt;/td&gt;
                  &lt;td class="colTitle" align="center" colspan="2"&gt;Two
                      I
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="colSubTitle"&gt;Pe&lt;/td&gt;
                  &lt;td class="colSubTitle"&gt;Ve&lt;/td&gt;
                  &lt;td class="colSubTitle"&gt;Pe&lt;/td&gt;
                  &lt;td class="colSubTitle"&gt;Ve&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="rowTitle"&gt;x&lt;/td&gt;
                  &lt;td class="colVerbDef"&gt;y&lt;/td&gt;
                  &lt;td class="rowTitle"&gt;z&lt;/td&gt;
                  &lt;td class="colVerbDef"&gt;c&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="rowTitle"&gt;r&lt;/td&gt;
                  &lt;td class="colVerbDef"&gt;t&lt;/td&gt;
                  &lt;td class="rowTitle"&gt;z&lt;/td&gt;
                  &lt;td class="colVerbDef"&gt;z&lt;/td&gt;
              &lt;/tr&gt;
  
          &lt;/table&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;table cellpadding="1" cellspacing="2" border="0"&gt;
              &lt;tr&gt;
                  &lt;td class="colTitle" align="center" colspan="4"&gt;
                      Da Titel2
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="colTitle" align="center" colspan="2"&gt;One
                  &lt;/td&gt;
                  &lt;td class="colTitle" align="center" colspan="2"&gt;Two
                      I
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="colSubTitle"&gt;Pe2&lt;/td&gt;
                  &lt;td class="colSubTitle"&gt;Ve2&lt;/td&gt;
                  &lt;td class="colSubTitle"&gt;Pe2&lt;/td&gt;
                  &lt;td class="colSubTitle"&gt;Ve2&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="rowTitle"&gt;x2&lt;/td&gt;
                  &lt;td class="colVerbDef"&gt;y2&lt;/td&gt;
                  &lt;td class="rowTitle"&gt;z2&lt;/td&gt;
                  &lt;td class="colVerbDef"&gt;c2&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="rowTitle"&gt;r2&lt;/td&gt;
                  &lt;td class="colVerbDef"&gt;t2&lt;/td&gt;
                  &lt;td class="rowTitle"&gt;z2&lt;/td&gt;
                  &lt;td class="colVerbDef"&gt;z2&lt;/td&gt;
              &lt;/tr&gt;
  
          &lt;/table&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p></p>