title: HTML table parser in PL/SQL
body: <p>I need to create HTML table parser, that will read the table cells in the correct order.</p>
  
  <p>Code I have so far:</p>
  
  <pre><code>html := '&lt;body&gt;
             &lt;table border="1"&gt;
               &lt;tr&gt;
                 &lt;td&gt;&lt;b&gt;A1&lt;/b&gt;&lt;/td&gt;
                 &lt;td&gt;&lt;i&gt;B1&lt;/i&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                 &lt;td&gt;&lt;b&gt;A2&lt;/b&gt;&lt;/td&gt;
                 &lt;td&gt;&lt;i&gt;B2&lt;/i&gt;&lt;/td&gt;
               &lt;/tr&gt;
             &lt;/table&gt;
           &lt;/body&gt;';
  
  FOR r IN (SELECT rownum rn, td FROM xmltable('*/table/tr' passing xmltype(html)
                                                           columns td xmltype path './td'))
  LOOP
    FOR c IN (SELECT cell FROM xmltable('.' passing r.td
                                                    columns cell VARCHAR(200) path '.'))
    LOOP
      dbms_output.put_line('Row ' || r.rn || ': ' || c.cell);
  
    END LOOP;
  END LOOP;
  </code></pre>
  
  <p>Now the result is:</p>
  
  <pre><code>Row 1: A1B1
  Row 2: A2B2
  </code></pre>
  
  <p>What I need is:</p>
  
  <pre><code>Row 1: A1
  Row 1: B1
  Row 2: A2
  Row 2: B2
  </code></pre>
  
  <p>How can I achieve that? Thanks for responses.</p>