jop
jop

Reputation: 679

PHP Xpath how to get nodes after a certain node

I have the following HTML page

<body>
<a href="zzz"></a>
<h1></h1>
<a href="bla1"></a>
<a href="bla2"></a>
</body>

I want to loop thru the href elements after the <h1 tag (so skip the tag with zzz url). What xpath do I need?

Upvotes: 1

Views: 72

Answers (1)

Severin
Severin

Reputation: 8588

This xpath should select the hyperlinks you want:

//h1/following-sibling::a

Upvotes: 1

Related Questions