code: public function xpathSingle($strXpathQuery)
      {
          $arrResults = $this->xpath($strXpathQuery);
  
          if ($arrResults === false) {
              //throw new Exception('xpathElement returned an unspecified error on '.$strXpathQuery);
              return null;
          }
  
          if (is_array($arrResults) && count($arrResults) == 0) {
              return null;
          } else {
              if (count($arrResults) > 1) {
                  throw new Exception(
                      'xpathSingle expects a single element as result, got ' . count($arrResults) . ' elements instead.'
                  );
              } else {
                  return current($arrResults);
              }
          }
      }
docs: Get a single element by xpath
  @param string $strXpathQuery
  @throws Exception
  @return static or NULL if not found