Hi,

Is there any action planned or taken because of the following?

Thanks,

On 4/3/07, Alexander Netkachev <[EMAIL PROTECTED]> wrote:

Hi,

I think it should be something similar to the following:
<?php

$doc = new DOMDocument();
$feed = $doc->appendChild($doc->createElement('feed'));
$feed->setAttribute('xmlns', ' 
http://www.w3.org/2005/Atom'<http://www.w3.org/2005/Atom%27>
);
$summary = $feed->appendChild($doc->createElement('summary'));
$summary->setAttribute('type', 'xhtml');

$xml = <<<EOF
<div xmlns="http://www.w3.org/1999/xhtml";>
<p>test<br/>test</p>
</div>
EOF;
$summaryDoc = new DOMDocument();
$summaryDoc->loadXml($xml);

$summary->appendChild($doc->importNode($summaryDoc->documentElement,
true));

echo $doc->saveXml();

returns

<feed xmlns=" http://www.w3.org/2005/Atom";>
<summary type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml";>
<p>test<br/>test</p>
</div>
</summary>
</feed>

BTW, Atom format supports different types of content, not only html/xhtml.
Of course, it is not required to support it right now, but API can accept
type as one of {html|xhtml|MIME TYPE}, not as boolean parameter as it is
now.

Sincerely,

On 4/3/07, Alexander Netkachev <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> It does not work but I'm not sure that I did everything correctly...
> Well, I applied the patch and change the default builder:
> Builder.php
> 348            $entry = new Zend_Feed_Builder_Entry($row['title'],
> $row['link'], $row['description'], true);
>
> And run the test:
>         $feedArray = array(
>             'title' => $blog['title'],
>             'link' => MYSPHERE_URL . '/blog/' . $id . '/atom',
>             'lastUpdate' => $feedUpdateDate,
>             'charset' => 'utf-8',
>             'author' => 'Alexander Netkachev',
>             'email' => ' [EMAIL PROTECTED] ',
>             'copyright' => 'Alexander Natkachev, all rights reserved',
>             'generator' => 'Zend Framework Zend_Feed',
>             'language' => 'en',
>             'entries' => array()
>         );
>         foreach ($posts as &$post) {
>             $feedArray['entries'][] = array(
>                 'title' => $post['title'],
>                 'link' => '...',
>                 'description' => $post['description'],
>                 'lastUpdate' => strtotime($post['modified'])
>             );
>         }
>         $feed = Zend_Feed::importArray($feedArray, 'atom');
>         $feed->send();
>
> and it returned the following feed:
>
> <feed xmlns="
>
> http://www.w3.org/2005/Atom"; xmlns:feed="http://www.w3.org/1999/xhtml";>
>   <id>
> http://projects:8081/MySphere/blog/2/atom
> </id>
>   <title><![CDATA[Blog]]></title>
>
>   <author>
>     <name>Alexander Netkachev</name>
>     <email>
> [EMAIL PROTECTED]
> </email>
>   </author>
>   <updated>2007-03-18T13:19:45+00:00</updated>
>   <link rel="self" href="
> http://projects:8081/MySphere/blog/2/atom
> " hreflang="en"/>
>   <rights>Alexander Natkachev, all rights reserved</rights>
>   <generator>Zend Framework Zend_Feed</generator>
>
>   <entry xmlns:feed="
> http://www.w3.org/1999/xhtml";>
>     <id>
> 
http://projects:8081/MySphere/blog/2/2007/03/18/zend-framework-beta-0-9-0-is-released
> </id>
>     <title><![CDATA[Zend Framework Beta 0.9.0 is released]]></title>
>     <updated>2007-03-18T13:19:45+00:00</updated>
>
>     <link rel="alternate" href="
>
> 
http://projects:8081/MySphere/blog/2/2007/03/18/zend-framework-beta-0-9-0-is-released"/>
>     <feed:summary xmlns:feed="
>
> http://www.w3.org/1999/xhtml"; 
type="xhtml">&lt;p&gt;test&lt;/p&gt;</feed:summary>
>   </entry>
> </feed>
>
> As I see:
> 1. summary should not be in feed namespace
> 2. div is missed. It looks like it should be provided by the builder or
> user's code but it is ok if is documented.
> 3. summary tag content is escaped when should not.
>
> I'll experiment with it more when have more time.
>
> Sincerely,
>
> On 4/2/07, Olivier Sirven < [EMAIL PROTECTED] > wrote:
> >
> > Hi,
> >
> > I see it is much more complicated than I thought ;)
> > Can you try the following patch to see if it fits your needs?
> > To apply it, just set the current directory to the root of your Zend
> > Framework
> > package and call patch command this way:
> > patch -p0 < /path/to/the/patch/zend_feed.patch
> >
> > To enable the support of xhtml atom content, you have to create your
> > entry
> > node like this:
> > <?php
> > // declare the summary as a valid xhtml content
> > $node = new Zend_Feed_Builder_Entry($title, $link, $summary, true);
> >
> > // add a valid xhtml data the the atom content node
> > $node->setContent($content, true);
> > ?>
> >
> > Olivier
> >
> > Le samedi 31 mars 2007, Alexander Netkachev a écrit :
> > > Hi,
> > >
> > > Atom has tree formats for text element content: text, html, xhtml.
> > >
> > > "text" means that the content of the element should be displayed as
> > it is,
> > > so if you write <summary
> > type="text"><![CDATA[<em>test</em>]]></summary>
> > > then you see exactly that is in the summary.
> > >
> > > "html" means that the content of the element is processed like it is
> > html
> > > with encoded entities.
> > > So, either of <summary
> > type="html"><![CDATA[<em>test</em>]]></summary> and
> > > <summary type="html">&lt;em&lt;test&lt;/em&gt;</summary> are the
> > same.
> > >
> > > "xhtml" means that the content of the entity is valid xhtml within
> > <div
> > > xmlns="...">...</div> tag.
> > > See RFC 4287: 3.1.1.3. XHTML
> > > <summary type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml";>
> > This is
> > > <b>XHTML</b> content. </div> </summary>
> > > So, CDATA does not help in this case because
> > > <summary type="xhtml"><![CDATA[<div></div>]]></summary> = <summary
> > > type="xhtml">&lt;div&lt;&lt;/div&gt;</summary>
> > > and it is incorrect format of the atom feed.
> > >
> > > Check the following feed:
> > > <feed xmlns=" http://www.w3.org/2005/Atom";>
> > >   <title type="xhtml"><![CDATA[<div
> > > xmlns="http://www.w3.org/1999/xhtml";>Alex @ Net
> > articles</div>]]></title>
> > >   <updated>2006-07-20T20:07:00Z</updated>
> > >   <author>
> > >     <name>Alexander Netkachev</name>
> > >   </author>
> > >   <id>http://alexatnet.com/blog/2 </id>
> > > </feed>
> > > using the http://validator.w3.org/feed/.
> > > It says that "Missing xhtml:div element" and "title claims to be
> > inline,
> > > but may contain html: div".
> > >
> > > So, the very right way to add the XML is to use type="xhtml" but it
> > is not
> > > possible with current Zend_Feed nor in <summary/> nor in <content/>.
> > > My Atom toolkit (
> > >
> > http://www.alexatnet.com/blog/2/2006/06/02/atom-syndication-framework)
> > has
> > > not nice Api, but it supports XHTML content as follows:
> > >
> > > $entry = $feed->Add(new Ant_Atom_Entry());
> > > $content = $entry->Add(Ant_Atom_Content::Inline( '<p><i>[Update: The
> > Atom
> > > draft is finished.]</i></p>', Ant_Atom_PlainText::Xhtml));
> > > $content->SetAttribute('xml:lang', 'en');
> > > $content->SetAttribute('xml:base', ' 
http://diveintomark.org/'<http://diveintomark.org/%27>
> > );
> > >
> > >
> > > Sincerely,
> >
> >
>
>
> --
> Alexander
> http://www.alexatnet.com/ - Blog and CMS created with Zend Framework and
> Ajax.
>



--
Alexander
http://www.alexatnet.com/ - Blog and CMS created with Zend Framework and
Ajax.




--
Alexander
http://www.alexatnet.com/ - Blog and CMS created with Zend Framework and
Ajax.

Reply via email to