public function QueryPath::xml in QueryPath 7.3
Same name and namespace in other branches
- 6 QueryPath/QueryPath.php \QueryPath::xml()
- 7.2 QueryPath/QueryPath.php \QueryPath::xml()
1 call to QueryPath::xml()
- QueryPath::xhtml in QueryPath/
QueryPath.php
File
- QueryPath/
QueryPath.php, line 1340
Class
Code
public function xml($markup = NULL) {
$omit_xml_decl = $this->options['omit_xml_declaration'];
if ($markup === TRUE) {
$omit_xml_decl = TRUE;
}
elseif (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 instanceof DOMDocument || $first
->isSameNode($first->ownerDocument->documentElement)) {
return $omit_xml_decl ? $this->document
->saveXML($first->ownerDocument->documentElement) : $this->document
->saveXML();
}
return $this->document
->saveXML($first);
}