title: PLSQL XMLTable XPath get all tags of furthest depth
body: <p>In PL/SQL is there a way to get all nodes of the furthest depth?</p>
  
  <p>Example 1:</p>
  
  <pre><code>&lt;responseObject&gt;
      &lt;response&gt;
          &lt;value1&gt;A&lt;/value1&gt;
          &lt;value2&gt;B&lt;/value2&gt;
          &lt;error&gt;A11&lt;/error&gt;
      &lt;response&gt;
  &lt;responseObject&gt;
  </code></pre>
  
  <p>Example 2:</p>
  
  <pre><code>&lt;responseObject&gt;
      &lt;response1&gt;A&lt;/response1&gt;
      &lt;response2&gt;B&lt;/response2&gt;
      &lt;response4&gt;D&lt;/response4&gt;
      &lt;random&gt;1&lt;/random&gt;
  &lt;responseObject&gt;
  </code></pre>
  
  <p>In example 1 I would like to get value1, value2, and error.  In example 2 I would like to get response1, response2, response4, and random.  Currently my XPath is set up as <code>'/responseObject/*/*'</code> but that doesn't work for the second case.</p>
  
  <p>Sample Code:</p>
  
  <pre><code>DECLARE
    lxml xmltype;
  begin
    lxml := 
    xmltype('&lt;responseObject&gt;
                &lt;response&gt;
                    &lt;value1&gt;A&lt;/value1&gt;
                    &lt;value2&gt;B&lt;/value2&gt;
                    &lt;error&gt;A11&lt;/error&gt;
                &lt;response&gt;
             &lt;responseObject&gt;');
  
    FOR test IN (
      select tag,
             VALUE
      FROM   xmltable('responseObject/*/*'
               passing lxml
               columns
                 tag VARCHAR2(128) path 'name()',
                 VALUE VARCHAR2(128) path '.'
             ) t
    )
    LOOP
      dbms_output.put_line(test.tag || ' - ' || test.value);
    END LOOP;
  end;
  </code></pre>