私はこのHTMLを持っています:
<div class="body">
<p>Some text 1</p>
<h2>Header 2</h2>
<p>Actual content</p>
</div>
私はそれを除いてすべてを取得したい<h2>
ので、次のようになります:
<p>Some text 1</p>
<p>Actual content</p>
これを達成しようとしています:
$crawler = new Crawler( $html );
$body = $crawler->filter( 'div.body' );
$body->rewind();
$body = $body->current();
$h2 = $crawler->filter('h2');
$h2->rewind();
$h2 = $h2->current();
$body->removeChild($h2);
しかし、私は得る:
[DOMException] 見つからないエラー
私は何が欠けていますか?