/**
  * Dumps the internal XML tree back into a string with added whitespace 
  * (new-lines and tabbing).
  * 
  * @param optional object DOMNode $node
  * @param optional int $options
  * @return string
  * @access public
  * @since 1/23/08
  */
 public function saveXMLWithWhitespace(DOMNode $node = null, $options = null)
 {
     $doc = new Harmoni_DOMDocument();
     if (is_null($node)) {
         if ($this->documentElement) {
             $doc->appendChild($doc->importNode($this->documentElement, true));
         }
     } else {
         $doc->appendChild($doc->importNode($node, true));
     }
     $doc->addWhitespaceToDocument();
     return $doc->saveXML($doc->documentElement, $options);
 }
 /**
  * Apply a single history entry to the plugin's history. 
  * 
  * @param SeguePluginsAPI $plugin
  * @param object DOMElement $element
  * @return void
  * @access protected
  * @since 1/23/08
  */
 protected function addPluginHistoryEntry(SeguePluginsAPI $plugin, DOMElement $element)
 {
     foreach ($element->childNodes as $child) {
         if ($child->nodeType == XML_ELEMENT_NODE && $child->nodeName != 'comment') {
             $doc = new Harmoni_DOMDocument();
             $doc->appendChild($doc->importNode($child, true));
             break;
         }
     }
     if (!isset($doc)) {
         throw new Exception("No version found.");
     }
     $comment = $this->getPluginHistoryComment($element);
     $timestamp = $this->getPluginHistoryTimestamp($element);
     $agentId = $this->getPluginHistoryAgentId($element);
     $plugin->importVersion($doc, $agentId, $timestamp, $comment);
 }