firefox icon

Firefox, Atom 1.0 and namespacing

Posted in Wed, 09 Aug 2006 10:16:00 GMT

It seems that Firefox's basic xml parser gets confused by xmlns and namespacing. Namely that if the feed is defined by:

<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:default="http://www.w3.org/1999/xhtml"
xmlns:dc="http://purl.org/dc/elements/1.1/">

Firefox's basic XML tree renderer won't recognize the XML if the entry content is wrapped by:

    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>Show submenus depending on where your users are.</p>
      </div>
    </content>

Basically it confuses xhtml:div with atom:div. If xmlns is removed from the div, Firefox is fine.

People don't generally use Firefox's XML tree to read Atom and the W3C Feed Validator doesn't have a problem with it so I'm wondering if this bug exists anywhere else.

This shows up when using XML::Atom because it uses XML::LibXML, which explicitly adds xmlns everywhere.

UPDATE 1: I thought it would be useful to include the following:

The Atom spec (section 4.1.3.3 Processing Model) says:

If the value of "type" is "xhtml", the content of atom:content MUST be a single XHTML div element [XHTML] and SHOULD be suitable for handling as XHTML. The XHTML div element itself MUST NOT be considered part of the content.

UPDATE 2: Apparently this behavior may be by design. Not very useful IMO but perhaps intentional. I think it would be more useful to have some Firefox settings that let you switch to XML tree mode or apply a default stylesheet.

del.icio.us:Firefox, Atom 1.0 and namespacing digg:Firefox, Atom 1.0 and namespacing reddit:Firefox, Atom 1.0 and namespacing spurl:Firefox, Atom 1.0 and namespacing wists:Firefox, Atom 1.0 and namespacing simpy:Firefox, Atom 1.0 and namespacing newsvine:Firefox, Atom 1.0 and namespacing blinklist:Firefox, Atom 1.0 and namespacing furl:Firefox, Atom 1.0 and namespacing fark:Firefox, Atom 1.0 and namespacing blogmarks:Firefox, Atom 1.0 and namespacing Y!:Firefox, Atom 1.0 and namespacing smarking:Firefox, Atom 1.0 and namespacing magnolia:Firefox, Atom 1.0 and namespacing segnalo:Firefox, Atom 1.0 and namespacing

7 comments

Comments

  1. Martin Payne said 33 minutes later:

    Isn’t that the expected behaviour? It recognises the XHTML content’s namespace, and so it renders it as such.

    Opera and Konqueror behave in the same way.

  2. John Wang said about 1 hour later:

    If it is, Firefox is inconsistent because it renders an XML tree when only <content type=”html”> is encountered.

  3. Martin Payne said about 1 hour later:

    It would do, because when the content is HTML, it doesn’t have an XML namespace associated with it. Also, HTML content needs to be escaped in order to remain well formed, so it wouldn’t be interpreted as markup anyway.

  4. John Wang said about 1 hour later:

    I’m happy as long as it looks okay in Atom readers. I’m not crazy about how Firefox displays xhtml atom:content because it doesn’t seem very human-readable and Firefox is for humans.

    For example, the Planet Catalyst Atom feed isn’t really legible in Firefox. The first entry is all mashed together because the summary has line breaks that don’t get translated into <br />’s. A more general issue is that Firefox shows the entry title after the content, even when the title is is before content in the Atom xml.

    I don’t think Firefox’s xhtml atom:content rendering is very useful but perhaps it’s not an issue because no one really uses it.

  5. Martin Payne said about 2 hours later:

    I agree that isn’t very legible! Then again, Atom isn’t really meant to be viewed like that.

    If you want it to look good in web browsers, you could format it with XSLT. For example, my Atom feed, which is formatted by newsfeed.xsl. It also serves the purpose of providing information to people who aren’t familiar with Atom.

  6. John Wang said about 3 hours later:

    Very nice. Seems like stylesheets is a solution for web browser viewing. It would be nice if Firefox had a decent default stylesheet or a button to render as an XML tree to make web browser reading easy.

    Just noticed that Typo (the blog engine used here) includes a CSS stylesheet for its RSS feed but the uri set by rss20_feed.rxml only works if the feed is on the same server and Typo is installed at the root uri (e.g. not /blog). I fixed the feed by hardcoding it in rss20_feed.rxml for now, another reason to move my Typo install to SVK. No stylesheet from Atom yet.

  7. Elbrother said 7 months later:

    Useful, Thanks for Post[www.ve.info.ve]

(leave url/email »)

   Comment Markup Help Preview comment