Who8MyFish Posted April 17, 2012 Share Posted April 17, 2012 So I'm using simplexml_load_file($url) to load up a client's XML file so I can use it with a jQuery slide show right. My problem is that some of the strings within the xml files are often times sentences and when I echo, for example... echo $xml->images->categories->category[$gallery]->images->image[0]->description[0] ; I should see Dream as if you'll live forever, Live as if you'll die today but all I'm getting is Dream as if you It appears as though php is getting confused when it sees those little single quotes. Anyone? Quote Link to comment Share on other sites More sharing options...
xyph Posted April 18, 2012 Share Posted April 18, 2012 You'd have to show us the XML file. It could be badly formatted. It's hard to replicate your issue as it is. Quote Link to comment Share on other sites More sharing options...
Psycho Posted April 18, 2012 Share Posted April 18, 2012 Have you looked at the actual HTML source code? Depending on the context of how you are actually echoing that content it could be that the output is all there, but that the rendered HTML doesn't display it. For example, this HTML code would produce the result you describe <a href='#' title='Dream as if you'll live forever, Live as if you'll die today'>Link</a> Quote Link to comment Share on other sites More sharing options...
Who8MyFish Posted April 19, 2012 Author Share Posted April 19, 2012 The problem was in the html. the ' in "you'll" was somehow being switched to a doublequote and so the elemnt looked a little like this. <a href='#' title='Dream as if you'll live forever, Live as if you"ll die today'>Link</a> A simple htmlspecialchars($myString, ENT_QUOTES); took care of that reallll quick. Thanks for the help though, spot on! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.