开发者

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
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜