// appends an ExtendedDocument::createElementJS() as a child of this document (see there for params)
// NO return value!
//
+ // function appendCOMElement($module, $attributes)
+ // appends an ExtendedDocument::createCOMElement() as a child of this document (see there for params)
+ // returns the new child
+ //
// function createElementLink($target, [$value])
// returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value
//
//
// function createElementJS($jsdata)
// returns an ExtendedElement that is an HTML <script> of JavaScript type with the JS data inside
+ //
+ // function createCOMElement($module, $attributes)
+ // returns an ExtendedElement that is in COM_NS namespace, with the given module as name and the
+ // given name=>value array as attributes
function __construct($version = '1.0', $encoding = 'utf-8') {
// make sure the default DOMDocument constructor runs
function appendJSElement($jsdata) {
$this->appendChild($this->createElementJS($jsdata));
}
+ function appendCOMElement($module, $attributes) {
+ $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
+ }
function appendHTMLMarkup($htmldata, $parentNode = null) {
if (is_null($parentNode)) { $parentNode =& $this; }
$jselem->appendChild($this->createCDATASection($jsdata));
return $jselem;
}
+
+ function createCOMElement($module, $attributes) {
+ $com_elem = $this->createElementNS(COM_NS, $module);
+ if (is_array($attributes) && count($attributes)) {
+ foreach ($attributes as $name=>$value) {
+ $com_elem->setAttribute($name, $value);
+ }
+ }
+ return $com_elem;
+ }
}
class ExtendedElement extends DOMElement {
// function appendJSElement($jsdata)
// appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
// NO return value!
+ //
+ // function appendCOMElement($module, $attributes)
+ // appends an ExtendedDocument::createCOMElement() as a child of this element (see there for params)
+ // returns the new child
function appendElement($name, $value = '') {
return $this->appendChild($this->ownerDocument->createElement($name, $value));
function appendJSElement($jsdata) {
$this->appendChild($this->ownerDocument->createElementJS($jsdata));
}
+ function appendCOMElement($module, $attributes) {
+ $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
+ }
}
class ExtendedDocumentFragment extends DOMDocumentFragment {
// function appendJSElement($jsdata)
// appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
// NO return value!
+ //
+ // function appendCOMElement($module, $attributes)
+ // appends an ExtendedDocument::createCOMElement() as a child of this fragment (see there for params)
+ // returns the new child
function appendElement($name, $value = '') {
return $this->appendChild($this->ownerDocument->createElement($name, $value));
function appendJSElement($jsdata) {
$this->appendChild($this->ownerDocument->createElementJS($jsdata));
}
+ function appendCOMElement($module, $attributes) {
+ $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
+ }
}
?>