ressio / pharse

Fastest PHP HTML Parser
83 stars 15 forks source link

All text nodes which are not an element nodes #45

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
How I can find all text nodes which are not an element nodes?

For example: 
I have this text.
<strong>Hallo!</strong> What <strong>are</strong> <strong>you doing</strong>?

And I want find only words "What" and "?". Is it possible?

Original issue reported on code.google.com by neumann....@gmail.com on 1 Aug 2013 at 2:09

strarsis commented 6 years ago

Edit: For inserting a text node you can re-use the code in the addText method, replacing $this with the parent element and addChild with insertChild (the other methods expect the offset passed by reference).