public function write($uri = null, $params = array())
    {
        if ($this->isValidXML($this->getContent())) {
            $this->uri = (isset($uri)) ? (string)$uri : $this->uri;
            $params = array_merge(array('format' => 'xml'), $params);
            return parent::write($this->uri, $params);
        } else {
            throw new \Exception('Attempting to write invalid XML content');
        }
    }
public function write($uri = null, $params = array())
    {
        if ($this->isValidXML($this->getContent())) {
            $this->uri = (isset($uri)) ? (string)$uri : $this->uri;
            $params = array_merge(array('format' => 'xml'), $params);
            return parent::write($this->uri, $params);
        } else {
            throw new \Exception('Attempting to write invalid XML content');
        }
    }
public function write ( $ uri = null , $ params = array ( ) ) { if ( $ this -> isValidXML ( $ this -> getContent ( ) ) ) { $ this -> uri = ( isset ( $ uri ) ) ? ( string ) $ uri : $ this -> uri ; $ params = array_merge ( array ( 'format' => 'xml' ) , $ params ) ; return parent :: write ( $ this -> uri , $ params ) ; } else { throw new \ Exception ( 'Attempting to write invalid XML content' ) ; } }
Write an XML document to the database.

@param string $uri A document URI.
@param array $params Optional additional parameters to pass when writing.
@return Document $this
Write an XML document to the database .