Subject: Re: Yahoo and "Media RSS"

From: [email-masked]
Date: Thu, 16 Dec 2004 14:01:02 EST

In a message dated 12/16/2004 6:10:25 PM GMT Standard Time, 
[email-masked] writes:

> Correct me if I'm wrong, but it looks a little broken:
> 
> <media:content url="http://www.foo.com/movie.mov" fileSize="12216320"
> type="video/quicktime"
>   playerUrl="http://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.

Doesn't the errata of Namespaces in XML cover this?

Although NE07 says something which I surmise it didn't intend to say. :)

Aren't namespaces in XML wonderful? :)

Andrew Watt

---

From: Danny Ayers <[email-masked]>
Date: Thu, 16 Dec 2004 21:05:45 +0100

Ok, I couldn't get my head around the namespace spec+errata, so
decided to try a little code, put my trust in Sun instead. I'm still
not 100% certain, but it does still look to me like the lack of prefix
on the attributes is a bug. I used SAX2 in JDK 1.4, the handler being:

  public void startElement(String namespaceURI, String localName,
      String qName, Attributes attributes) {
    System.out.println("\nElement ns = '" + namespaceURI+"' name = '"
        + localName+"'");
    for (int i = 0; i < attributes.getLength(); i++) {
      System.out.println("attr ns = '" + attributes.getURI(i) + "' name = '"
          + attributes.getLocalName(i) + "'");
    }
  }

Running this on http://tools.search.yahoo.com/mrss/mrss-4.xml which
contains lines like:

<media:content url="http://www.foo.com/song128kbps.mp3"
fileSize="2000" bitrate="128" type="audio/mpeg" expression="full">

yielded:

Element ns = '' name = 'rss'
attr ns = '' name = 'version'

Element ns = '' name = 'channel'

Element ns = '' name = 'title'

Element ns = '' name = 'link'

Element ns = '' name = 'description'

Element ns = '' name = 'item'

Element ns = '' name = 'title'

Element ns = '' name = 'link'

Element ns = 'http://docs.yahoo.com/mediaModule' name = 'content'
attr ns = '' name = 'url'
attr ns = '' name = 'fileSize'
attr ns = '' name = 'bitrate'
attr ns = '' name = 'type'
attr ns = '' name = 'isDefault'
attr ns = '' name = 'expression'

Element ns = 'http://docs.yahoo.com/mediaModule' name = 'content'
attr ns = '' name = 'url'
attr ns = '' name = 'fileSize'
attr ns = '' name = 'bitrate'
attr ns = '' name = 'type'
attr ns = '' name = 'expression'

Element ns = 'http://docs.yahoo.com/mediaModule' name = 'content'
attr ns = '' name = 'url'
attr ns = '' name = 'fileSize'
attr ns = '' name = 'bitrate'
attr ns = '' name = 'type'
attr ns = '' name = 'expression'

Element ns = 'http://docs.yahoo.com/mediaModule' name = 'people'

Element ns = 'http://docs.yahoo.com/mediaModule' name = 'category'

>  Aren't namespaces in XML wonderful? :)

Indeed they are!

Cheers,
Danny.

-- 

http://dannyayers.com