-
Notifications
You must be signed in to change notification settings - Fork 44
Getting Started: 9. Removing Nodes
Daniele Orlando edited this page Feb 21, 2016
·
2 revisions
Removing a node is just a matter of querying.
$food->remove('//egg'); // Removes all the eggs.
Which is the same of
$food->query('//egg')->remove(); // Removes all the eggs.
Querying and removing with relative XPaths/CSS-Selectors can be done too.
$food->query('/doc')->remove('egg'); // Removes all the eggs.
Pro Tip:
->remove(...$xpath)
accepts the same arguments of->query(...$xpath)
.
This means that, like->query()
, even->remove()
accepts multiple queries.$food->remove('//fruit', '//pasta', '//pizza');