0

Assume the following

<a>
    <b></b>
    <c></c>
    <d>
        <e></e>
        <f></f>
    </d>
    <g>
        <h>
            <i></i>
        </h>
    </g>
</a>

Now, using XPATH in PHP, what is a generic query that will select leaf nodes. In the example above, the result would be nodes b, c, e, f, and i.

Please note that the xpath query should be generic because I do not have any control over what the input html is, all I need is select the leaf nodes as explained in the above example.

If xpath does not work, what is an alternative solution?

Thanks.

Greeso
  • 7,544
  • 9
  • 51
  • 77

0 Answers0