NYCPHP Meetup

NYPHP.org

[nycphp-talk] Is this XML valid?

David Roth davidalanroth at gmail.com
Sat Sep 19 14:53:52 EDT 2009


> David Roth wrote:
>
> > <?xml version="1.0" ?>
> > <document type="db download">
> >
> > <packages total_weight="15.8" total_packages="1">
> > <package length="147" width="5" height="5" weight="15.8"/>
> > </packages>
> >
> > I was expecting each attribute and node to have it's own <> and </ 
> >, and
> > the data not to be surround by double-quotes or am I missing  
> something?
>
> XML attributes must be quoted, but you can use either double or single
> quotes. If there's nothing between the opening & closing tags you can
> use the shorthand tag, just as you would with <img src="foo.gif" /> or
> <br />.
>
> http://www.tizag.com/xmlTutorial/xmltag.php
> http://www.tizag.com/xmlTutorial/xmlattributes.php
>
> Bev

So if the above is valid XML, is there a specific name for this  
approach? Is there a benefit for doing it this way instead of nested  
nodes? Might this be considered older method?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090919/de06a0cc/attachment.html>


More information about the talk mailing list