New function "queryValue"

This commit is contained in:
Michael 2020-09-12 19:23:23 +00:00
parent cb647b5b6c
commit 20b25a1acd
2 changed files with 17 additions and 8 deletions

View file

@ -488,6 +488,15 @@ class XML
return $first_item->attributes;
}
public static function queryValue($xpath, $search, $context)
{
$result = $xpath->query($search, $context)->item(0)->nodeValue;
if (!is_object($result)) {
return '';
}
return $result->nodeValue;
}
/**
* escape text ($str) for XML transport
*