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'

On Thu, 16 Dec 2004 14:01:02 EST, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:

>  Aren't namespaces in XML wonderful? :)

Indeed they are!

Cheers,
Danny.

-- 

http://dannyayers.com

Reply via email to