/** * Remove the file entry from the XML. * * @return NULL */ public function delete() { $file = $this->getFileNode(); $dir = $this->_parent->getDirectoryNode(); $this->_xml->removeWhitespace($file->previousSibling); $dir->removeChild($file); }
/** * Insert the directory entry into the XML at the given point. * * @param Horde_Pear_Package_Xml_Element_Directory $parent The parent. * @param DOMNode $point Insertion point. * * @return NULL */ private function _insert(Horde_Pear_Package_Xml_Element_Directory $parent, DOMNode $point = null) { if ($point === null) { $point = $parent->getDirectoryNode()->lastChild; } else { if ($point->previousSibling) { $ws = trim($point->previousSibling->textContent); if (empty($ws)) { $point = $point->previousSibling; } } } $dir = $this->_xml->insert(array("\n " . str_repeat(" ", $this->_level), 'dir' => array('name' => $this->_name), ' ', $this->_xml->createComment(' ' . $this->_path . ' ')), $point); $this->_xml->append("\n" . str_repeat(' ', $this->_level + 1), $dir); $this->setDirectoryNode($dir); }