From cea5b93aab85131665c215c7df6ed297004db3b6 Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Fri, 23 Apr 2010 22:52:11 +0200 Subject: [PATCH] create new extended DOM classes and start using those, making working with DOM more convenient --- include/cbsm/util/document.php-class | 169 +++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100755 include/cbsm/util/document.php-class diff --git a/include/cbsm/util/document.php-class b/include/cbsm/util/document.php-class new file mode 100755 index 0000000..07a635a --- /dev/null +++ b/include/cbsm/util/document.php-class @@ -0,0 +1,169 @@ + + * + * ***** END LICENSE BLOCK ***** */ + +class ExtendedDocument extends DOMDocument { + // ExtendedDocument PHP class + // this extends the general PHP DOM Document class to simplify some usual constructs + // + // function __construct([$version], [$encoding]) + // CONSTRUCTOR + // construct a new DOM Document that uses our element definitions + // + // function appendElement($name, [$value]) + // appends a DOMDocument::createElement() as a child of this document (see there for params) + // returns the new child + // + // function appendElementXML($name, $xmldata) + // appends a DOMDocument::createElement() with the given name as a child of this document, + // with an ExtendedDocument::createXMLFragment() of the given XML data inside + // returns the new child + // + // function appendLink($target, [$value]) + // appends an ExtendedDocument::createElementLink() as a child of this document (see there for params) + // returns the new child + // + // function appendText($text) + // appends a DOMDocument::createTextNode() as a child of this document (see there for params) + // returns the new child + // + // function appendRawMarkup($markupdata) + // appends an ExtendedDocument::createElementRawMarkup() as a child of this document (see there for params) + // NO return value! + // + // function appendJSElement($jsdata) + // appends an ExtendedDocument::createElementJS() as a child of this document (see there for params) + // NO return value! + // + // function createXMLFragment($xmldata) + // returns a DOMDocumentFragment containing the DOM of the given XML data + // + // function createElementLink($target, [$value]) + // returns an ExtendedElement that is an HTML with the given target (href) and (optional) value + // + // function createElementRawMarkup($markupdata) + // returns a DOMNode containing a representation of the given raw markup data + // + // function createElementJS($jsdata) + // returns an ExtendedElement that is an HTML