From 6638efd5690cd46471a3e01c164e572956a34aa3 Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Mon, 14 Nov 2016 18:30:43 +0100 Subject: [PATCH] add appendEntity() function to ExtendedDocument - note that it only works for *named* entities, not *numeric* ones though --- include/cbsm/util/document.php-class | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/cbsm/util/document.php-class b/include/cbsm/util/document.php-class index 32d4e3e..41e817a 100755 --- a/include/cbsm/util/document.php-class +++ b/include/cbsm/util/document.php-class @@ -116,6 +116,10 @@ class ExtendedDocument extends DOMDocument { // appends a DOMDocument::createTextNode() as a child of this document (see there for params) // returns the new child // + // public function appendEntity($name) + // appends a DOMDocument::createEntityReference() as a child of this document (see there for params) + // returns the new child + // // public function appendComment($comment_data) // appends a DOMDocument::createComment() as a child of this document (see there for params) // returns the new child @@ -302,6 +306,9 @@ class ExtendedDocument extends DOMDocument { public function appendText($text) { return $this->appendChild($this->createTextNode($text)); } + public function appendEntity($name) { + return $this->appendChild($this->createEntityReference($name)); + } public function appendComment($comment_data) { return $this->appendChild($this->createComment($comment_data)); } @@ -606,6 +613,10 @@ class ExtendedElement extends DOMElement { // appends a DOMDocument::createTextNode() as a child of this element (see there for params) // returns the new child // + // public function appendEntity($name) + // appends a DOMDocument::createEntityReference() as a child of this element (see there for params) + // returns the new child + // // public function appendComment($comment_data) // appends a DOMDocument::createComment() as a child of this element (see there for params) // returns the new child @@ -696,6 +707,9 @@ class ExtendedElement extends DOMElement { public function appendText($text) { return $this->appendChild($this->ownerDocument->createTextNode($text)); } + public function appendEntity($name) { + return $this->appendChild($this->ownerDocument->createEntityReference($name)); + } public function appendComment($comment_data) { return $this->appendChild($this->ownerDocument->createComment($comment_data)); } @@ -805,6 +819,10 @@ class ExtendedDocumentFragment extends DOMDocumentFragment { // appends a DOMDocument::createTextNode() as a child of this fragment (see there for params) // returns the new child // + // public function appendEntity($name) + // appends a DOMDocument::createEntityReference() as a child of this fragment (see there for params) + // returns the new child + // // public function appendComment($comment_data) // appends a DOMDocument::createComment() as a child of this fragment (see there for params) // returns the new child @@ -895,6 +913,9 @@ class ExtendedDocumentFragment extends DOMDocumentFragment { public function appendText($text) { return $this->appendChild($this->ownerDocument->createTextNode($text)); } + public function appendEntity($name) { + return $this->appendChild($this->ownerDocument->createEntityReference($name)); + } public function appendComment($comment_data) { return $this->appendChild($this->ownerDocument->createComment($comment_data)); } -- 2.35.3