Subscribe to
Posts
Comments
NSLog(); Header Image

Atom Feed Issues

I wanted to modify the Atom feed with some HTML, but that breaks validation. Here's a sample:

<content type="text/html" mode="escaped"
    xml:lang="en" xml:base="<MTBlogURL encode_xml="1">">
<p><MTEntryExcerpt encode_xml="1"></p>
<p><a href="http://nslog.com/" title="Visit NSLog();">Click</a></p>

I thought it should work. It defines the type, after all, as text/html. Instead, feedvalidator tells me "Undefined content element: p". Hmmmm.

The MovableType default template is:

<content type="text/html" mode="escaped"
    xml:lang="en" xml:base="<$MTBlogURL encode_xml="1"$>">
<$MTEntryBody encode_xml="1"$>
<$MTEntryMore encode_xml="1"$>

Any ideas? It's probably something silly, and when someone gives the right answer I'll smack my forehead. Video available to the person who gets causes such a reaction. šŸ™‚

3 Responses to "Atom Feed Issues"

  1. Aside from the fact that your [a] tag isn't closed, which I assume is a case of trying to get a simple example up quickly, I think the problem with what you're doing is that the p and a elements aren't defined in the atom spec, which is what you're saying if you have xmlns="http://purl.org/atom/ns#draft-ietf-atompub-format-07" or something like that in your feed element. That defines a default namespace, indicating that all elements without a specific namespace are in that one. What you need to do is to specify that the p and a tags are in the XHTML namespace, either by specifying an alternate namespace in your feed element and prefixing it to your p and a (making them xhtml:p and xhtml:a, as a possible example) or by overriding the default namespace inherited from the feed element, as is done in the example in the draft IETF spec for Atom (see the example at the top of page 3 ).

    Hope this helps.

  2. Thanks. Using "xhtml:" in the tags didn't work, but I'll try finding another namespace.

  3. I've got it. It's fixed now. Thanks Patrick.


Trackback URI | Comments RSS

Leave a Reply

Please abide by the comment policy. Valid HTML includes: <blockquote><p>, <em>, <strong>, <ul>, <ol>, and <a href>. Please use the "Quote Me" functionality to quote comments.