protected function getXpathQueryResult($query, $cast = null)
{
$xpath = $this->xPath();
$result = $xpath->query($query);
if ($result->length > 0) {
$value = $result->item(0)->nodeValue;
if ($cast) {
settype($value, $cast);
}
return $value;
} else {
return null;
}
}