*/ class rdf { // Header Variablen public $content_type='Content-type: application/xhtml+xml'; // string public $xml_header=''; // string public $xml_ns; // string protected $rdf_url; // string protected static $rdf_text; protected static $nl="\n"; protected static $tb="\t"; // Objekt Variablen protected $counter=0; // int public $obj_id; // string public $obj = array(); public $attr = array(); // string /** * Konstruktor - Uebergibt die Connection und laedt optional eine Reservierung * @param $reservierung_id */ public function __construct($xml_ns=null,$rdf_url=null) { $this->xml_ns = $xml_ns; $this->rdf_url = $rdf_url; } /** * Prueft die Variablen vor dem Speichern * auf Gueltigkeit. * @return true wenn ok, false im Fehlerfall */ public function newObjekt($id) { $this->obj[$this->counter] = new rdf(); $this->obj[$this->counter++]->setObjID($id); return $this->counter-1; } public function setObjID($id) { $this->obj_id=$id; return true; } public function sendHeader($cache=false) { if ($cache) { } else { header("Cache-Control: no-cache"); header("Cache-Control: post-check=0, pre-check=0",false); header("Expires Mon, 26 Jul 1997 05:00:00 GMT"); header("Pragma: no-cache"); } header($this->content_type); echo ''; return true; } public function setAttribut($name,$value,$cdata=true) { $this->attr[$this->counter]->name=$name; $this->attr[$this->counter]->value=$value; $this->attr[$this->counter]->cdata=$cdata; $this->counter++; //var_dump($this->attr); return true; } public function createRdfHeader() { $this->rdf_text="\n".'xml_ns.'="'.$this->rdf_url.'/rdf#"'."\n".'>'."\n\t" .''."\n"; } public function createRdfData() { foreach ($this->obj as $obj) { $this->rdf_text.="\n\t".'' ."\n\t\t".''; foreach ($obj->attr as $attr) $this->rdf_text.="\n\t\t\t<".$this->xml_ns.':'.$attr->name.'>value.']]>xml_ns.':'.$attr->name.'>'; $this->rdf_text.="\n\t\t".''."\n\t".''; } } public function createRdfFooter() { $this->rdf_text.=''."\n".''."\n\t"; } public function sendRdfText() { //echo $this->rdf_text; if (!isset($this->rdf_text)) { $this->createRdfHeader(); $this->createRdfData(); //$this->createRdfSequence(); $this->createRdfFooter(); } echo $this->rdf_text; return true; } } ?>