private function removeXPath(string $expression, callable $callback = null): self {
        $nodes = $this->document()->findXPath($expression);

        foreach ($nodes as $node) {
            if (is_null($callback) || $callback($node)) {
                $node->remove();
            }
        }

        return $this;
    }
private function removeXPath(string $expression, callable $callback = null): self {
        $nodes = $this->document()->findXPath($expression);

        foreach ($nodes as $node) {
            if (is_null($callback) || $callback($node)) {
                $node->remove();
            }
        }

        return $this;
    }
private function removeXPath ( string $ expression , callable $ callback = null ) : self { $ nodes = $ this -> document ( ) -> findXPath ( $ expression ) ; foreach ( $ nodes as $ node ) { if ( is_null ( $ callback ) || $ callback ( $ node ) ) { $ node -> remove ( ) ; } } return $ this ; }
Remove using via XPath expressions

@param string $expression
@param callable $callback

@return self
Remove using via XPath expressions