Location: PHPKode > projects > FarODP > farodp/includes/xml/FarODPRDFObject.php
<?php

class FarODPRDFObject extends AbstractVisitor {
	var $result;
	var $curCat;
	var $curElement = '';
	var $xml;
	var $level = 0;
	var $priority = 0;
	
	function FarODPRDFObject() {
	    $this->xml = new XMLObject();
	    $this->xml->openElement(0, 'rdf:RDF', array(
			'xmlns:rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
            'xmlns:dc' => 'http://purl.org/dc/elements/1.1/'
			));
	}

	function getXML() {
		return '<?xml version="1.0" encoding="UTF-8" ?' . '>' . "\n" .
	    $this->xml->getXML();
	}

	function close($level) {
	}

	function commonVisit($n, $level) {

	    if ($level < $this->level) {
	        $diff = $this->level - $level;
	    	$this->xml->close($diff - 1);
		} else if ($this->level === $level) {
		}
	    $this->level = $level;
	}
	
	function visitFarODP($n, $level) {
	    $this->commonVisit($n, $level);
	}

	function visitODPNode($n, $level) {
		$this->commonVisit($n, $level);
	}

	function visitCurCat($n, $level) {
		$this->commonVisit($n, $level);
	    $this->curCat = $n->cat;
	}
	
	/* A to Z list. */

	function visitAToZ($n, $level) {
		$this->commonVisit($n, $level);
	}

	function visitAToZItem($n, $level) {
		$this->commonVisit($n, $level);
	}
	
	/* Browse categories */

	function visitBrowseCategoryContainer($n, $level) {
		$this->commonVisit($n, $level);
	}

	function visitBrowseCategorySection($n, $level) {
		$this->commonVisit($n, $level);
		$this->priority++;
	}

	function visitBrowseCategory($n, $level) {
		$this->commonVisit($n, $level);
	}

	function visitBrowseCategorySymbolic($n, $level) {
		$this->commonVisit($n, $level);
	}

	function visitBrowseCategoryRelated($n, $level) {
		$this->commonVisit($n, $level);
	}
	
	/* Listings */
	
	function visitBrowseListingContainer($n, $level) {
		$this->commonVisit($n, $level);
	
	}

	function visitBrowseListing($n, $level) {
		$this->commonVisit($n, $level);
	    if ($n->isStar) {
			$this->xml->openElement($level, 'rdf:Description', array(
			'rdf:about' => $n->url,
			'dc:star' => '1'
			));
	    } else {
			$this->xml->openElement($level, 'rdf:Description', array(
				'rdf:about' => $n->url,
			));
	    }
	    $this->xml->openElement($level, 'dc:Title');
	    $this->xml->addText($n->title);
	    $this->xml->closeElement();
	    $this->xml->openElement($level, 'dc:Description');
	    $this->xml->addText($n->description);
	    $this->xml->closeElement();
	    $this->xml->closeElement();
	}

	function visitCategoryRelatedSection($n, $level) {
		$this->commonVisit($n, $level);
		
	}
	
	function visitSearchListingContainer($n, $level) {
		$this->commonVisit($n, $level);
		
	}

	function visitSearchListing($n, $level) {
		$this->commonVisit($n, $level);

	}
}

?>
Return current item: FarODP