Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

No CDATA block in content block of atom feed  #82

@av3

Description

@av3

Hello,

I wanted to provide feeds (via the Writer of Zend Feed) with the full content of an article (including some HTML5 markup) and thought to prefer atom over rss. But the writer is acting different and causes some trouble for me.

My code:

    $entry = $feed->createEntry();
    $entry->setContent($news->getText);

Output for RSS:

    <item>
      <content:encoded><![CDATA[<p>My content ...</p>]]></content:encoded>

Output for Atom:

  <entry xmlns:xhtml="http://www.w3.org/1999/xhtml">
    <content xmlns:xhtml="http://www.w3.org/1999/xhtml" type="xhtml">
      <xhtml:div xmlns:xhtml="http://www.w3.org/1999/xhtml">
        <xhtml:p>My content ...</xhtml:p>
      </xhtml:div>
    </content>
  </entry>

And if I add any image to it in HTML5-Style <img src="myimage.jpg"> instead of XHTML-Style <img src="myimage.jpg" />, I get a warning:

DOMDocument::loadXML(): Opening and ending tag mismatch: img line 1 and p in Entity, line: 1

In the atom example in the documentation there is the output:

        <content type="html">
            <![CDATA[I am not writing the article.
                     The example is long enough as is ;).]]>
        </content>

In _setDescription I found $dom->createCDATASection (Entry\Rss and Entry\Atom). But in Atom it's just the summary and in Rss the Content.

In Entry\Atom the _setContent is relevant for the content block, which I wanted to use to output the full content and not just a summary. And there I found $element->setAttribute('type', 'xhtml') in _setContent.

I doubt that the atom output of the example in the documentation is even possible with Zend Feed or am I wrong? It would be great, if the atom feed would also use the CDATA blockinstead of the xhtml for the content.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions