Empty xml element for future use
If I want to make adding something to an XML file very simple can I do this:
<small>$1.99</small>
<medium></med开发者_开发问答ium>
<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.
Leaving the field blank is valid xml and it'll be up to your parser to work out what is returned when parsing.
foreach($items as $items)
{
if(! empty($item))
{
//do something
}
}
精彩评论