private function to_xml($result) { switch ($this->content_type) { case 'xml': return xml::parse($result); case 'json': return xml::json($this->root[0], $result); default: runtime_error('Unknown HTTP procedure content type: ' . $this->content_type); } }
function wwwsession($type, $name) { $xml = new xml(); if (session::exists($name)) { switch ($type) { case 'value': $xml->append($xml->element($name, session::value($name))); break; case 'vector': foreach (session::vector($name) as $value) { $xml->append($xml->element('value', $value)); } break; case 'map': foreach (session::map($name) as $key => $value) { $xml->append($xml->element($key, $value)); } break; case 'xml': $xml = session::xml($name); break; case 'object': $xml = xml::json($name, session::value($name)); break; default: runtime_error('Unknown session variable type: ' . $type); } } return $xml->get(); }