Поделиться через


Yahoo's Media RSS and Yet More Syndication Geeks Misunderstanding How XML Works

I saw a recent post from Dave Winer berating Yahoo! where he wrote

Yahoo is the strangest most jealous and behind-the-scenes plotting and scheming of tech companies. When any of the other "giants" moves in RSS space I get plenty of advance notice so that I can help them promote it, maybe even make it better before it's announced. Yahoo, as a company seems jealous and insecure, seems to have as a goal, replacing me. Hey it's been tried before, probably isn't worth the trouble. And it's amazing for all the lack of respect, how much of my (unpatented) work they're using to reshape their company. If I didn't know better I might think that someone inside the company is claiming credit for my work and doesn't want the boss to know. ";->"

I wasn't sure what this post was about so I did a little Googling and came upon a post on the atom-syntax mailing list entitled Yahoo and "Media RSS" which points out that Yahoo! has created a specification entitled "Media RSS" Specification Version .9 (DRAFT). I found it interesting that Yahoo! is throwing its weight behind a spec to replace the current mechanisms used for podcasting. I am not surprised that Dave Winer was irritated especially since some of the stuff in the spec seems extremely questionable (the media:people is a single element that can contain multiple people separated by the '|' character, attributes like playerWidth & playerHeight that are supposed to control how big the media player window used to consume content should be, etc).

However before getting deeper into the Yahoo! specification I stumbled on a post by Danny Ayers on the atom-syntax mailing list which expressed some confusion about how XML vocabularies are defined

Correct me if I'm wrong, but it looks a little broken:

<media:content url="https://www.foo.com/movie.mov"; fileSize="12216320"
type="video/quicktime"
    playerUrl="https://www.foo.com/player?id=1111"; playerHeight="200"
playerWidth="400"
    isDefault="true" expression="full" bitrate="128" duration="185">

The attributes aren't namespace-qualified, yet aren't defined in the
RSS 2.0 spec.

Danny Ayers seems to think that the absence of a namespace name on an attribute is equivalent to the attribute being in some 'empty' namespace along with other types that are in no namespace in that vocabulary. That is actually incorrect. The best documentation to put one straight on how to consider to elements and attributes in today's age of XML namespaces is the W3C XML Schema Primer. The XML Schema recommendation is the primary specification which describes how defining XML vocabularies in a namespace aware manner is supposed to work.

An attribute with an explicit namespace name (i.e. that has a prefix) is a global attribute which belongs to a particular vocabulary. There is only one declaration of an attribute with that name (namespace URI & local name pair) in the vocabulary. On the other hand, an attribute without a namespace name is scoped locally to the element it is declared on and is only defined in the context of that element. This means in a particular vocabulary multiple definitions of an attribute with a particular name can exist if it is un-namespaced since it is scoped locally to its owner element. 

Since Danny Ayer's is the co-author of the upcoming book entitled Beginning RSS and Atom Programming  I hope he does some more research on designing XML vocabularies before the book is published. A lot of the power of RSS is the ability authors have of defining their own vocabularies as RSS modules and I'd hate to see a new generation of RSS module designers inherit a bunch of bad habits because they read the wrong stuff in a book.

Comments