' ), array ( '&' , '"', ''' , '<' , '>' ), $string ); } function xmlparse($string) { $xml = simplexml_load_string($string); $result = $xml->xpath("//role[@role='Full']"); //$result = $xml->xpath("//role"); //var_dump($result); return $result; } // Connecting, selecting database $dbconn = pg_connect("host=localhost dbname=customers8 user=postgres ") or die('Could not connect: ' . pg_last_error()); // Performing SQL query $query = 'select prrfnbr, txname, txsdesc, to_char(pravdate,\'Dy, DD Mon YYYY\') as hmerom, prmedia from product left outer join prodrel on plcprnbr=prrfnbr left outer join txts on txprnbr=prrfnbr where prpub=1 and (prtype=27371 or plpprnbr=29414) and txlgnbr=\'el\' order by pravdate desc limit 20'; $result = pg_query($query) or die('Query failed: ' . pg_last_error()); // Printing results in HTML header('Content-type: text/xml', true); print ""; print ""; print " "; print " Τα νέα του ΥΘΥΝΑΛ (http://www.yen.gr)"; print " http://www.yen.gr"; print " Τα νέα του ΥΘΥΝΑΛ (RSS) - Τελευταία 20 γεγονότα"; print " el"; print " Copyright 2010, A&IP Press Office"; print " egov@yen.gr (MMM,A&IP eGov Office)"; while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) { print " "; print " ".xmlentities($line["txname"]).""; /*print " ".xmlparse(str_replace(""," ",$line["prmedia"]))."";*/ print " http://www.yen.gr/wide/yen.chtm?prnbr=".$line["prrfnbr"].""; print " ".xmlentities($line["txsdesc"]).""; print " http://www.yen.gr/wide/yen.chtm?prnbr=".$line["prrfnbr"].""; //print " Wed, 02 Oct 2002 13:00:00 GMT\n"; print " ".$line["hmerom"].""; print " 5"; print " "; } print " "; print " "; // Free resultset pg_free_result($result); // Closing connection pg_close($dbconn); ?>