If I got a DOMDocument like this:
<div name="outer">
<div name="inner"></div>
<div name="inner"></div>
</div>
<div name="outer">
</div>
<div name="outer">
<div name="inner"></div>
</div>
If I do $dom->getElementsByTagName('div'), I am going to get all 6 elements, including the inner ones.
How can I for example select the second outer div element? (name is just to show what I mean, the elements don’t have these propertys for real!)
Edit:
I know I could use xpath, but I am more likely looking for a solution without it as I am using only the DOMDocument functions in the rest of my code.
Use DOMXPath