function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PiPi 

Want to implement extensions modules like Dublic Core tags and Content tags

Hi,

 

Please help me to create extension module tags as I'm implementing RSS feeds

I only want to implement 3 tags <content:encoded>, <dc:coverage> and <![CDATA[ ]]>.

I tried using methods but none of them are worked. I am implementing in VISUALFORCE. 

PiPi

Twan thanks for your reply.

I'm sorry to say that I did'nt found anything useful from that link.

I want implement the following code

Please do help me 

Thanks in advance

 

<rss xmlns:content="http://pusdfgrl.org/rss/1.0/modules/content/" xmlns:dc="http://pasdrl.org/dc/elements/1.1/" version="2.0">

<channel>
<title>Today RSS feed</title>
<link>http://asdf.asdf<;/link>
<description> Today</description>
<item>
<title>Today for Friday, May 20, 2011</title>
<pubDate>Fri, 27 May 2011 17:34:48 GMT</pubDate>
<guid isPermaLink="false">20110520</guid>
<content:encoded><![CDATA[<P>Public schools are open.<br />Alternate side parking is in effect.<br /> Garbage/Recycling pick-up is suspended.Edited1<br /></P> <P><P>This was the status at the end of the day. It does not reflect earlier updates.</P></P>]]></content:encoded>
<dc:coverage>2011-05-20</dc:coverage>
</item>
<item>
<title>Today for Saturday, May 21, 2011</title>
<pubDate>Fri, 27 May 2011 17:34:48 GMT</pubDate>
<guid isPermaLink="false">20110521</guid>
<content:encoded><![CDATA[P>This was the status at the end of the day. It does not reflect earlier updates.</P></P>]]></content:encoded>
<dc:coverage>2011-05-21</dc:coverage>
</item>
....
....
</channel>
</rss>
TwanTwan

Do you generate the xml in a controller ?

PiPi

yes Twan

TwanTwan

Could you show the VF & APEX code pls.

PiPi

In below visualforce page I have implemented CDATA tag manually and for <dc:coverage> and <content:encoded> tags there is no colon which are hardcoded. When I tried with colon its giving error. Please fix this issue.

 

Please find below Apex controller and Visualforce page

 

Visualforce page:

<apex:page contenttype="text/xml" sidebar="false" showheader="false" controller="RssFeedController" >
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<title> Today RSS feed</title>
<link>https://ap1.salesforce.com/a06/o</link>
<description>Philadelphia Today</description>
<apex:repeat value="{!sObjects}" var="cnt">
<item>
<title>{!cnt.title__c}</title>
<pubDate>{!cnt.pubDate__c}</pubDate>
<guid isPermaLink="false">{!cnt.guid__c}</guid>
<contentencoded>{!cnt.content__c}
<![CDATA[P>{!cnt.coverage__c}</P></P>]]>
</contentencoded>
<dccoverage>{!cnt.coverage__c}</dccoverage>
<link>{!cnt.link__c}</link>
<description>{!cnt.description__c}</description>
</item>
</apex:repeat>
</channel>
</rss>
</apex:page>

 

 

 

Apex Controller:

 

public class RssFeedController{

 

          public List<Today__c> sObjects {get;set;}

          public RssFeedController(){

 sObjects = [SELECT                                       Channel__c,content__c,coverage__c,description__c,guid__c,link__c,pubDate__c,title__c FROM Today__c
where Created_Date__c>=:system.today()-7 AND Created_Date__c<=:system.today()+31];
}
}

TwanTwan

I suggest :

 

1. creating all the xml in the apex with the DOM apex object

http://www.salesforce.com/us/developer/docs/apexcodepre/Content/apex_xml_dom.htm

then create a string using toXmlString()

 

2. on visual force side, just output the generated string

 

 

PiPi

Twan,

Thanks for your support. 
I hope it'll work and please can you clarify that can I use 'colon' in that tags.

and now even I don't want to use any visualforce page and want to produce

direct xml output from apex class only, will that work??
If it works please could you assist me? 

 

Thanks in advance

TwanTwan

seems ok executing anonymously this :

 

Dom.Document doc = new Dom.Document();
 Dom.XmlNode rootElement = doc.createRootElement('name', 'pop','prefix');
rootElement.addChildElement('coverage', 'http://pasdrl.org/dc/elements/1.1/' , 'dc' );
system.Debug(doc.toXmlString());

 

 06:58:36.040 (40412000)|USER_DEBUG|[4]|DEBUG|<?xml version="1.0" encoding="UTF-8"?><prefix:name xmlns:prefix="pop"><dc:coverage xmlns:dc="http://pasdrl.org/dc/elements/1.1/" /></prefix:name>