I've got this snippet:
<div>
<p>This content is flagged as <code>TODO</code>. It has another element of <code>TODO</code> neither of the nested elements should be a child of div.</p>
</div>
in lxml I'm using the xpath selection of:
//div/child::*
This is giving me a list of three items p, code, and code. However, code and code shouldn't be considered children of div, but descendants of div. In fact, when I use //div/descendant::*
I get the same three items. Ultimately I don't know how many children will be in a div, could be 1 or 100, but I only need the direct child, not any descendant elements.
Anyone have any ideas of how to do this with lxml? Or is it simply a bug I'll have to wait to get fixed?