public function QueryPath::html in QueryPath 7.2
Same name and namespace in other branches
- 6 QueryPath/QueryPath.php \QueryPath::html()
- 7.3 QueryPath/QueryPath.php \QueryPath::html()
File
- QueryPath/
QueryPath.php, line 1139
Class
Code
public function html($markup = NULL) {
if (isset($markup)) {
if ($this->options['replace_entities']) {
$markup = QueryPathEntities::replaceAllEntities($markup);
}
$doc = $this->document
->createDocumentFragment();
$doc
->appendXML($markup);
$this
->removeChildren();
$this
->append($doc);
return $this;
}
$length = $this
->size();
if ($length == 0) {
return NULL;
}
$first = $this
->getFirstMatch();
if (!$first instanceof DOMNode) {
return NULL;
}
if (!$first->ownerDocument->documentElement) {
return NULL;
}
if ($first instanceof DOMDocument || $first
->isSameNode($first->ownerDocument->documentElement)) {
return $this->document
->saveHTML();
}
return $this->document
->saveXML($first);
}