Jump to content

simple xml, differences


Hailwood

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.