You are here

public function QPXML::comment in QueryPath 6

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

File

QueryPath/Extension/QPXML.php, line 45

Class

QPXML

Code

public function comment($text = NULL) {
  if (isset($text)) {
    foreach ($this->qp
      ->get() as $element) {
      $comment = $element->ownerDocument
        ->createComment($text);
      $element
        ->appendChild($comment);
    }
    return $this->qp;
  }
  foreach ($this->qp
    ->get() as $ele) {
    foreach ($ele->childNodes as $node) {
      if ($node->nodeType == XML_COMMENT_NODE) {
        return $node->textContent;
      }
    }
  }
}