3 ms·
> Atom though unambiguously specifies that the <title> (and other) elements should be treated as plaintext unless specified otherwise with the type attribute.
by bscphil 2y ago
> Atom though unambiguously specifies that the <title> (and other) elements should be treated as plaintext unless specified otherwise with the type attribute.
I haven't looked at the part of the Atom spec you're talking about, but what does "treat as plaintext" mean when a title could be the literal text "</title><script src=..."
- LinAGKar 2y agoThen the reader should display that as text, and not try to parse it. Assuming that's actually the textual content of the <title> element, which would then be serialized <title><![CDATA[</title><script src=...]]></title> or <title></title><script src=...</title>. If the markup reads <title></title><script src=...</title>, that would probably mean you've got a buggy feed generator constructing the markup by hand instead of using an XML serializer. Based on the how I understand the RSS spec, a feed could possibly contain <title><![CDATA[<i>Title</i>]]></title> and expect the title to be italic, but in Atom it would have to be <title type="html"><![CDATA[<i>Title</i>]]></title> to render as italic, otherwise the "<i>Title</i>" would be written out literally by a compliant reader.
- kevincox 2y agoNo. In both RSS and Atom the content of the title tag is a string (and is encoded into the XML as required). The question is just if if that string should be treated as text/plain or text/HTML. RSS doesn't specify. This type of ambiguity is the main reason that I recommend using Atom.
- ttepasse 2y agoAtom has even three variants of the content model, one where the content is XHTML. As pure text <atom:title atom:type="text">E = mc²</atom:title> As entity-encoded “HTML”: <atom:title atom:type="html>E = mc<sup>2</sup></atom:title> Or as directly embedded XHTML: <atom:title atom:type="xhtml> <div xmlns="http://www.w3.org/1999/xhtml"> <var>E</var> = <var>m</var><var>c</var><sup>2</sup> </div> <atom:title> (The superfluous div element seems to be a result of a compromise for the early 2000s web environment, afair.)