I think I got it. But why won't it work? <?php $quotes = simplexml_load_file("quotes.xml") or die ("Whoops!"); //line 180 index.php $max = count($quotes->quote); //zero-based $numbers = range(0, $max); shuffle($numbers); //loop with the necessary code for($i = 0; $i <= 2; $i++){ echo <<<END <li><span class="quote">$quotes->quote[$numbers[$i]]</span><img class="quotearrow" src="../_media/_global/testimonials-arrow.gif" /><span class="quoteby"><h4>$quotes->quote[$numbers[$i]]['sayswho']</h4>$quotes->quote[$numbers[$i]]['whoisthe']</span></li> END; } ?> PHP: I'm getting this error Warning: simplexml_load_file() [function.simplexml-load-file]: quotes.xml:3: parser error : xmlParseEntityRef: no name in D:\xampp\htdocs\somesite\index.php on line 180 PHP:
Here's the file quotes.xml. It's just placeholder text for now but it doesn't work. <?xml version="1.0" encoding="utf-8"?> <testimonials> <quote sayswho="JM" whoisthe="King">I’m still using Ubuntu Edgy Eft with the Ubuntu Studio Theme + Neutronium Theme. ... Ubuntu & Windows XP. Where did you learn that kind of dual boot?</quote> <quote sayswho="Jim Lee" whoisthe="Joker">I want to dual boot linux and XP on my laptop (maybe thinking about ... I believe Ubuntu Studio (as far as I'm aware) is Ubuntu with ALOT of ...</quote> <quote sayswho="Minimo" whoisthe="Loophole">The Ubuntu Studio theme is a cool and amazing theme for your Ubuntu! .... Make Ubuntu look like Vista · How To Prevent Windows XP Users From Writing To US.</quote> </testimonials> Code (markup): Actually, can anyone show me how to access the information in this xml file including its attributes?
As a quick test, can you try removing the ' from "I'm" in the first quote, then try your script again.
I said that in a previous post, but didn't see the & in his XML, I must not of been paying attention. Greg is correct, the & will parse as malformed XML - you should use & (ampersand) instead.