Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

DiDom: find and edit text nodes

$
0
0

I'm studying the DiDom library. I need to find all the text nodes (links should be ignored) and modify them. That's not how it works:

$document = new Document($text);$element = $document->find('body');$texts = $element[0]->findInDocument("*:not(a)::text()");foreach ($texts as $key => $value) {    $value = "xxx";}echo $document->html();

How is it possible to do this?

P.S.: This can be done in the "Simple HTML DOM", but I can't make a correct selector there:(


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>