struzik-vladislav/xpath-extended

Additional functions for XPath

v1.0.0 2017-09-15 23:57 UTC

This package is auto-updated.

Last update: 2024-04-26 16:19:26 UTC


README

Additional functions for XPath.

Usage

Initialisation

<?php

use XPath\DOMXPath;

$xpath = new DOMXPath($domdocument);

XPath\quote('string')

Quotes a string for use in a query.

<?php

$needle = 'abd\'efg';
$expr = sprintf('//root:root/root:node[php:functionString("XPath\quote", text()) = \'%s\']', $needle);
$list = $xpath->query($expr);