Daniel Aleksandersen wrote:
Hi emailing list, (message contains Unicode characters)

I am curious about the status of the required <div> container when including xhtml in text constructs. With it be changed to become optional instead? The below example never made much sense to me.


No. it is required.

<feed … xmlns:xht="http://www.w3.org/1999/xhtml";>
   …
    <summary type="xhtml">
      <xht:div>
        <xht:p>This is a <xht:em>summary</xht:em> paragraph.</xht:p>
      </xht:div>
    </summary>
  …
</feed>

Instead I am currently using a ‘hack’ which involves declaring the type as application/xhtml+xml instead of xhtml. It is not directly invalid, according to the Atom format specifications. However, it is not very well supported either. I always contain the XHTML in paragraphs or other XHTML element; so it stays valid XML all the time.

<feed … xmlns:xht="http://www.w3.org/1999/xhtml";>
   …
    <summary type="application/xhtml+xml">
      <xht:p>This is a <xht:em>summary</xht:em> paragraph.</xht:p>
    </summary>
  …
</feed>


Don't do this. It's not valid either way. When type="application/xhtml+xml", the content is expected to be processable as a complete XHTML document, which obviously is not the case. Hacks like this are most likely just to lead to interoperability problems later.

Is there a better way of doing this? —with ‘better’, I am ‘better supported and with a higher adoption rate’. My main concern is that some feed readers may not be able to support my undocumented implementation/interpretation. Anyone got any experiences in this field?


The best approach is to stick to the standard and to not try to work around it.

- James

What about the <article> or <section> elements from the HTML 5 (+XML) working draft? They would both become much better containers than a meaningless <div> if it is absolutely required to have one.

Reply via email to