Hailwood Posted June 27, 2010 Share Posted June 27, 2010 hi guys so, can anyone tell me why i end up with different results with each of these <product_display_price> </product_display_price> = [product_display_price] => SimpleXMLElement Object ( [0] => ) <product_display_price>Ham $5.00</product_display_price> = [product_display_price] => Ham $5.00 <product_display_price/> = [product_display_price] => SimpleXMLElement Object ( ) all i did was $xml = simplexml_load_string($this->xml_data); echo '<pre>'; print_r($xml->xpath('/menu/products_list/product')); die('</pre>'); so, why does an empty element give me an empty object ^ expected a element with a string in it give me a string ^expected yet a element with a " " string gives me an object with a " " string in it ^not expected i would have expected it to act as either a string or an empty element Link to comment https://forums.phpfreaks.com/topic/205989-simple-xml-differences/ Share on other sites More sharing options...
Hailwood Posted June 28, 2010 Author Share Posted June 28, 2010 bump Link to comment https://forums.phpfreaks.com/topic/205989-simple-xml-differences/#findComment-1078010 Share on other sites More sharing options...
helptar Posted June 28, 2010 Share Posted June 28, 2010 I would give more details if you expect help. This would be a stab in the dark otherwise. Link to comment https://forums.phpfreaks.com/topic/205989-simple-xml-differences/#findComment-1078049 Share on other sites More sharing options...
salathe Posted June 28, 2010 Share Posted June 28, 2010 All of the values will be instances of SimpleXMLElement, they just vary in the way that print_r outputs them due to the magic of SimpleXML. Link to comment https://forums.phpfreaks.com/topic/205989-simple-xml-differences/#findComment-1078081 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.