/** * Inserts a node to the childNodes list of the current node * @param Object The node to be inserted * @param Object The node before which the insertion is to occur * @return Object The inserted node */ function &insertBefore(&$newChild, &$refChild) { $type = $newChild->nodeType; if ($type == DOMIT_ELEMENT_NODE) { if ($this->documentElement == null) { parent::insertBefore($newChild); $this->setDocumentElement($newChild); } else { //error thrown if documentElement already exists! DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, 'Cannot have more than one root node (documentElement) in a DOMIT_Document.'); } } else { DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, 'Cannot insert a node of type ' . get_class($newChild) . ' to a DOMIT_Document.'); } return $newChild; }
/** * DOM Notation node constructor (NOT YET IMPLEMENTED!) */ function DOMIT_Notation() { DOMIT_DOMException::raiseException(DOMIT_NOT_SUPPORTED_ERR, 'Cannot instantiate DOMIT_Notation class. Notation nodes not yet supported.'); }
/** * Gets the value of the specified attribute, if it exists * @param string The attribute name * @return string The attribute value */ function getAttribute($name) { if ($this->hasAttribute($name)) { return $this->attributes[$name]; } else { DOMIT_DOMException::raiseException(DOMIT_NOT_FOUND_ERR, 'No attribute named ' . $name . 'exists.'); } }
/** * Creates a new DOMIT_DocumentType node (not yet implemented!) * @param string The $qualifiedName * @param string The $publicID * @param string The $systemID * @return Object The new document type node */ function &createDocumentType($qualifiedName, $publicID, $systemID) { //not yet implemented DOMIT_DOMException::raiseException(DOMIT_NOT_SUPPORTED_ERROR, 'Method createDocumentType is not yet implemented.'); }