becu Posted April 6, 2008 Share Posted April 6, 2008 Hi, I'm trying to parse XML data, but every time the <title> tag contains a single quote, part of the title to the left of the single quote disappear. Can anybody help me to fix this? ex: John's bookstore this case, I can only get "bookstore" Thank you. Link to comment https://forums.phpfreaks.com/topic/99774-parsing-xml-contains-single-quote/ Share on other sites More sharing options...
Barand Posted April 6, 2008 Share Posted April 6, 2008 <?php $str = "<root> <name>test</name> <items> <item> <id>1</id> <title>john's bookstore</title> </item> <item> <id>2</id> <title>the bookstore</title> </item> </items> </root>"; $xml = simplexml_load_string($str); echo '<pre>', print_r($xml, true), '</pre>'; foreach ($xml->items->item as $x) { echo "$x->id : $x->title <br/>"; } ?> results --> 1 : john's bookstore 2 : the bookstore Link to comment https://forums.phpfreaks.com/topic/99774-parsing-xml-contains-single-quote/#findComment-510286 Share on other sites More sharing options...
becu Posted April 6, 2008 Author Share Posted April 6, 2008 thank you. it worked!!!! Link to comment https://forums.phpfreaks.com/topic/99774-parsing-xml-contains-single-quote/#findComment-510290 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.