tags:

views:

50

answers:

2

If I want to make adding something to an XML file very simple can I do this:

<small>$1.99</small>
<medium></medium>
<large>$3.99</large>

Can I leave the medium element blank and tell the php parser to ignore it?

I'm thinking that when I parse it I am going to want all the sizes returned but not a size with no price.

+4  A: 

Leaving the field blank is valid xml and it'll be up to your parser to work out what is returned when parsing.

Scobal
A: 
foreach($items as $items)
{ 
    if(! empty($item))
    { 
        //do something
    }
}
gahooa