psymon25 Posted May 9, 2008 Share Posted May 9, 2008 Hi All I am very new to PHP... I have been trying some code found on the adobe website to create a dynamic XML file... What I have seems to work but A: fails XML validation and B: the £ sign is replaced with a ? The content in the database is stored in HTML as the description field is created using FckEditor... I have posted the code any advice is welcome...Thanks <? header('Content-type: text/xml charset=utf-8'); print '<?xml version="1.0" encoding="utf-8"?>'."\n"; <source> <publisher>mysite</publisher> <publisherurl>http://www.mysite.com</publisherurl> <? Mysql Connection stuff $q="SELECT * FROM some table"; $doGet=mysql_query($q); while($result = mysql_fetch_array($doGet)){ ?> <? $content = str_replace("<br />", "n", $result); $content = str_replace("&", "&", $result); $content = html_entity_decode($result['description']);?> <job> <referencenumber><![CDATA[diam<?=$result['id'];?>]]></referencenumber> <company><![CDATA[mysite.com]]></company> <url><![CDATA[http://www.mysite.com/url/file.php?id=<?=$result['id'];?>]]></url> <title><![CDATA[<?=$result['title'];?>]]></title> <category><![CDATA[<?=$result['Category'];?>]]></category> <description><![CDATA[<?=strip_tags($content);?>]]></description> <salary><![CDATA[<?=$result['salary'] ?>]]></salary> <jobtype><![CDATA[<?=$result['jobstype']; ?>]]></jobtype> <state><![CDATA[<?=$result['state']; ?>]]></state> <country><?=$result['country']; ?></country> <city><![CDATA[<?=$result['city']; ?>]]></city> <date><![CDATA[<?= $result['date']; ?>]]></date> </job> <? } ?> </source> Link to comment https://forums.phpfreaks.com/topic/104822-php-cdata-xml-file/ Share on other sites More sharing options...
psymon25 Posted May 12, 2008 Author Share Posted May 12, 2008 Ok I found a workaround.. In firefox the £ sign shows as a ? ... In IE it shows as a sqaure.. So I save the page as an xml file and use notepad++ to find the sqaure and replace with a £ sign... so far this works so if anyone has any idea how to automate this and maybe tell me how to save these results off as an xml file automatically that would be great... Thanks Link to comment https://forums.phpfreaks.com/topic/104822-php-cdata-xml-file/#findComment-538961 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.