You are here

public function QueryPath::innerXHTML in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/QueryPath.php \QueryPath::innerXHTML()
  2. 7.2 QueryPath/QueryPath.php \QueryPath::innerXHTML()

File

QueryPath/QueryPath.php, line 1184

Class

QueryPath

Code

public function innerXHTML() {
  $length = $this
    ->size();
  if ($length == 0) {
    return NULL;
  }
  $first = $this
    ->getFirstMatch();
  if (!$first instanceof DOMNode) {
    return NULL;
  }
  elseif (!$first
    ->hasChildNodes()) {
    return '';
  }
  $buffer = '';
  foreach ($first->childNodes as $child) {
    $buffer .= $this->document
      ->saveXML($child, LIBXML_NOEMPTYTAG);
  }
  return $buffer;
}