PHP-tiedoston muuntaa XML

<?
function parseToXML ( $htmlStr )
{
$xmlStr = str_replace ( '<' , '&lt;' , $htmlStr );
$xmlStr = str_replace ( '>' , '&gt;' , $xmlStr );
$xmlStr = str_replace ( '"' , '&quot;' , $xmlStr );
$xmlStr = str_replace ( "'" , '&apos;' , $xmlStr );
$xmlStr = str_replace ( "&" , '&amp;' , $xmlStr );
return
$xmlStr ;
}

/ / Start XML-tiedoston, kaiku vanhempi solmu
; echo "<items>";

echo "<erä";
. parseToXML ( stripslashes ( $sName )) . '" ' ; echo 'name = "". parseToXML (stripslashes ($ sName)). "";
. parseToXML ( stripslashes ( $sAddress )) . '" ' ; echo 'address = "". parseToXML (stripslashes ($ sAddress)). "";
. parseToXML ( $iPrice ) . '" ' ; echo 'hinta =' ". parseToXML ($ iPrice)." ";
. parseToXML ( $sLink ) . '" ' ; echo 'link = "". parseToXML ($ slink). "";
. parseToXML ( stripslashes ( $tDetails )) . '" ' ; echo 'details = "". parseToXML (stripslashes ($ tDetails)). "";
. parseToXML ( stripslashes ( $sOther )) . '" ' ; echo 'muut = "". parseToXML (stripslashes ($ sOther)). "";
; echo "/> ';

/ / End XML-tiedoston
; echo "</ tuotteet> ';

?>

Voit jättää vastauksen , tai trackback omalta sivustoltasi.

Jätä vastaus

Sinun täytyy olla kirjautuneena kommentoidaksesi.