#2 WordPress b2rdf.php and b2rss2.php mod_content elements

closed-works-for-me
nobody
None
5
2003-09-14
2003-08-15
No

The WordPress 0.71 RSS 1.0 and RSS 2.0 feed output
files, respectively b2rdf.php and b2rss2.php, are missing
critical mod_content elements. While the feeds validate,
because the CONTENT:ENCODED content type value is
not declared, they are not well-formed XML and can
break the RSS feed when XML entity references are
used within the CONTENT field (the body of the blog
post).

This patch only fixes the CONTENT element of the feed
and does not addess the issue of entity references in
the TITLE and DESCRIPTION elements. A workaround for
this latter problem is to manually enter the reserved XML
entity references for the angle brackets ("<"
and ">"), the apostrophe ("'"), and the
ampersand ("&").

After this section in b2rdf.php and b2rss2.php:

<?php
} else { // use content
?
<<description><?php the_content_rss('’, 0, ‘’,
$rss_excerpt_length, 2) ?>
</description>
<?php
} // end else use content
?>

add the following elements and change
CONTENT:ENCODED to CONTENT:ENCODING:

<content:items>
<rdf:Bag>
<rdf:li>
<content:item>
<content:format
rdf:resource="http://www.w3.org/1999/xhtml" />
<content:encoding
rdf:resource="http://www.w3.org/TR/REC-xml#dt-
wellformed" />
<rdf:value rdf:parseType="Literal"
xmlns="http://www.w3.org/1999/xhtml">
<content:encoding>
[NOTE: everything else within this line between the
start and end elements of CONTENT:ENCODING stays
the same; change only the word ENCODED to
ENCODING]
</content:encoding>
</rdf:value>
</content:item>
</rdf:li>
</rdf:Bag>
</content:items>

While the above patch also works on the WordPress 0.71
b2rss2.php file which produces the RSS 2.0 feed, note
that according to Ben Hammersley's Content Syndication
with RSS (O'Reilly, 2003), although the specification
supports the use of RSS 1.0 modules, use of RDF within
RSS 2.0 is not endorsed.

The RSS 2.0 Specification, however, was moved to
Harvard Law School's Berkman Center for Internet &
Society where RSS 2.0 inventor and UserLand Software
founder Dave Winer is a Fellow. The specification is
under new management with an advisory board.
According to the July 15, 2003 announcement of this
change, the RSS 2.0 is now customizable and extensible.

For examples of this patch in action see
http://www.davidmattison.ca/wordpress/b2rdf.php or
http://www.davidmattison.ca/wordpress/b2rss2.php

Discussion

  • D.H. Mattison

    D.H. Mattison - 2003-08-15

    Logged In: YES
    user_id=829912

    I wasn't sure whether the angle brackets would get
    accepted, so I used "<" and ">" instead.

     
  • D.H. Mattison

    D.H. Mattison - 2003-09-14
    • status: open --> closed-works-for-me
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks