MidOhioIT Posted May 11, 2010 Share Posted May 11, 2010 when using the following code: $xml3 = simplexml_load_file('image_and_link_featured.xml'); $images3 = array(); foreach($xml3->pic as $link) { $links3[] = $link->link; } $Featurelink1 = $links3[0]; I get the errors: image_and_link_featured.xml:5: parser error : EntityRef: expecting ';' in /index_with_links.php on line 29 Warning: simplexml_load_file() [function.simplexml-load-file]: <link>show_coupon.php?catparam=5&business in /index_with_links.php on line 29 Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /index_with_links.php on line 29 Warning: Invalid argument supplied for foreach() in /index_with_links.php on line 31 Here are lines 29 - 31: $xml3 = simplexml_load_file('image_and_link_featured.xml'); $images3 = array(); foreach($xml3->pic as $link) Here is the xml file content that can not change: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <images> <pic> <image>featuredsponsor1.jpg</image> <link>show_coupon.php?catparam=5&business=MATTRESS+ONE+FURNITURE+COMPANY</link> </pic> </images> Does anone have any ideas? It is obvious to me is is not liking the link because of what is in it but I am ok with it just reading it as a text string Link to comment https://forums.phpfreaks.com/topic/201325-php-reading-in-xml-file-error/ Share on other sites More sharing options...
teamatomic Posted May 11, 2010 Share Posted May 11, 2010 Its the ampersand. If that the only ampersand in the file, that is there is nothing else like  , then just handle the file first and str_replace the ampersand with & HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/201325-php-reading-in-xml-file-error/#findComment-1056267 Share on other sites More sharing options...
MidOhioIT Posted May 11, 2010 Author Share Posted May 11, 2010 thanks teamatomic , What you said was the fix, much appriciated Link to comment https://forums.phpfreaks.com/topic/201325-php-reading-in-xml-file-error/#findComment-1056361 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.