/**
  * Initialize all internal structures to begin with some serialization.
  * Returns true if initialization was successful (this means that the
  * optional output file is writable).
  * @param string $outfilename URL of the file that output should be written
  * to, or empty string for writting to the standard output.
  *
  * @return boolean
  */
 protected function prepareSerialization($outfilename = '')
 {
     $this->serializer->clear();
     $this->element_queue = array();
     $this->element_done = array();
     if ($outfilename !== '') {
         $this->outputfile = fopen($outfilename, 'w');
         if (!$this->outputfile) {
             // TODO Rather throw an exception here.
             print "\nCannot open \"{$outfilename}\" for writing.\n";
             return false;
         }
     }
     return true;
 }
 public function clear()
 {
     parent::clear();
     $this->namespaces_are_global = false;
     $this->namespace_block_started = false;
 }
 public function clear()
 {
     parent::clear();
     $this->sparql_namespaces = array();
 }