|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Cffeed - creating RSS Feeds and guid
Author: Jayesh Viradiya
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53408#288662
Yes Ray....What you have mentioned is correct. For Query, ID=GUID. And
While creating a feed via struct, we use the literal values as in the
specs.
For reading feeds into queries we wanted to provide a common predefined
query format which stands for both RSS 2.0 and ATOM 1.0 , hence the
query column names are different than the actual respective syndication
formats. And hence in the doc you could see the Mappings for RSS2/ATOM1
with the predefined Query Columns name.
Thanks
Jayesh Viradiya
Adobe CF Team
I've confirmed that what you say is right Jayesh - guid works when you
create the feed via struct.
So can you confirm if the following statement is correct:
When creating a feed via a query, you should name your columns based
on what the PDF describes, ie, ID==GUID.
When creating a feed via a struct, you use the literal values.
(Frankly, I don't know how much CFFEED helps you at this point as you
are doing more work than you would if you generated the XML by hand.
;)
----- Excess quoted text cut - see Original Post for more -----
Author: Raymond Camden
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53408#288656
I've confirmed that what you say is right Jayesh - guid works when you
create the feed via struct.
So can you confirm if the following statement is correct:
When creating a feed via a query, you should name your columns based
on what the PDF describes, ie, ID==GUID.
When creating a feed via a struct, you use the literal values.
(Frankly, I don't know how much CFFEED helps you at this point as you
are doing more work than you would if you generated the XML by hand.
;)
----- Excess quoted text cut - see Original Post for more -----
Author: Raymond Camden
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53408#288655
Jayesh, I was able to create a NPE by not supplying isPermaLink:
<cfscript>
// Create the feed data structure and add the metadata.
myStruct = StructNew();
mystruct.link = "http://www.cnn.com";
myStruct.title = "CNN";
mystruct.description = "This... is... CNN";
mystruct.pubDate = Now();
mystruct.version = "rss_2.0";
/* Add the feed items. A more sophisticated application would use
dynamic variables
and support varying numbers of items. */
myStruct.item = ArrayNew(1);
myStruct.item[1] = StructNew();
myStruct.item[1].description = StructNew();
myStruct.item[1].description.value = "Desc 1";
myStruct.item[1].link = "http://www.cnn.com/1.cfm";
myStruct.item[1].pubDate = Now();
myStruct.item[1].title = "Title one";
myStruct.item[1].guid = structNew();
myStruct.item[1].guid.value = "http://www.foo.com";
myStruct.item[2] = StructNew();
myStruct.item[2].description = StructNew();
myStruct.item[2].description.value = "Desc 2";
myStruct.item[2].link = "http://www.cnn.com/2.cfm";
myStruct.item[2].pubDate = Now();
myStruct.item[2].title = "Title Two";
</cfscript>
<!--- Generate the feed and save it to a file and variable. --->
<cffeed action = "create"
name = "#myStruct#"
overwrite = "yes"
xmlVar = "myXML">
<cfdump var="#xmlParse(myXML)#">
----- Excess quoted text cut - see Original Post for more -----
Author: Raymond Camden
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53408#288654
Jayesh - what about my comment about using "ID" in query? It worked
there. And the docs plainly say that ID means GUID in query data.
If ID works for query, but GUID works for struct, then I'd consider
that a bug - and confusing at that.
----- Excess quoted text cut - see Original Post for more -----
Author: Nathan C. Smith
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53408#288650
OK, According to Jayesh Viradiya (Thanks Jayesh!)
To use the guid value in cffeed it will look something like this:
<cfset myStruct.item[i].guid = structnew()>
<cfset myStruct.item[i].guid.isPermaLink="YES/NO(anyone)">
<cfset myStruct.item[i].guid.value = "http://www.google.com">
/me goes to try it out.
-Nate
----- Excess quoted text cut - see Original Post for more -----
Author: Jayesh Viradiya
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53408#288646
Hi Nathan,
In the repro case provided by you, I could notice that you were trying
to use an Invalid attribute(linkhref) for the GUID element. GUID could
have only one Optional element that is "isPermaLink". Check RSS 2.0 spec
for more information.
So modify your Code with the following lines at appropriate places and
it should work fine. Although there is a bug that IsPermaLink acts as
mandatory attribute as of now. We are tracking that bug.
<cfset myStruct.item[i].guid = structnew()>
<cfset myStruct.item[i].guid.isPermaLink="YES/NO(anyone)">
<cfset myStruct.item[i].guid.value = "http://www.google.com">
Thanks
Jayesh Viradiya
Adobe CF Team
Hi Nathan C. Smith
Could you please isolate the code which throws the Null Pointer
exception and post it here or send it to me at "jayvir@adobe.com" for us
to be able to reproduce it in order to investigate it.
Thank you
Jayesh Viradiya
Adobe CF Team
Author: Jayesh Viradiya
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53408#288555
Hi Nathan C. Smith
Could you please isolate the code which throws the Null Pointer
exception and post it here or send it to me at "jayvir@adobe.com" for us
to be able to reproduce it in order to investigate it.
Thank you
Jayesh Viradiya
Adobe CF Team
Author: Raymond Camden
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53408#288548
I found it. If you look in the CFML 8 Reference, page 191, there is a
giant table that lists all of the query columns and what they mean. If
you find ID, you will see that it means GUID for RSS 2.
I specified ID for my test and it worked fine, I got a GUID in my
feed. (But note I tested with a query, not a struct.)
----- Excess quoted text cut - see Original Post for more -----
Author: Nathan C. Smith
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53408#288516
> I believe href will then be used for the value. If not, try
> link perhaps.
>
If I work backwards and read a feed into cffeed there is a "linkhref" in the
guid struct. I'm pretty sure I tried that one going the other direction
though.
-Nate
Author: Nathan C. Smith
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53408#288515
> Don't feel too bad. The docs for CFFEED leave a _lot_ out. This blog
> article is a good example:
>
> http://www.coldfusionjedi.com/index.cfm/2007/8/22/Metadata-pro
perties-for-CFFEED
----- Excess quoted text cut - see Original Post for more -----
Gave those a try. Cfdump shows the values are making it into the struct,
but something goes wrong in cffeed.
The error: "The system has attempted to use an undefined value, which
usually indicates a programming error, either in your code or some system
code.
Null Pointers are another name for undefined values. "
I assume that means that the name of the vlue they expect is empty and
different from the one I have given them.
I tried url, href, permalink, link, guid, value and among others.
-Nate
Author: Raymond Camden
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53408#288514
Don't feel too bad. The docs for CFFEED leave a _lot_ out. This blog
article is a good example:
http://www.coldfusionjedi.com/index.cfm/2007/8/22/Metadata-properties-for-CFFEED
So as to your problem, I looked here:
http://feedvalidator.org/docs/rss2.html#ltguidgtSubelementOfLtitemgt
and I see one example has guid as a simple value. One has it like so:
http://feedvalidator.org/docs/rss2.html#ltguidgtSubelementOfLtitemgt
So this is what I'd try.
<cfset myStruct.item[i].guid = structNew()>
<cfset myStruct.item[i].guid.href = qrtRSS.permalink>
I believe href will then be used for the value. If not, try link perhaps.
----- Excess quoted text cut - see Original Post for more -----
Author: Nathan C. Smith
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53408#288513
I'm trying to use cffeed in ColdFusion 8 to create an RSS 2.0 feed. I
basically lifted the example from the docs. I'm running into problems
with the guid field. I used Feed validator to check what I had
(http://feedvalidator.org/docs/warning/MissingGuid.html) and it
told me I
was missing a GUID field.
I added the field in my code:
<cfset myStruct.item[i].guid = qryRSS.permalink>
And CF told me it had to be a struct. So if I create a new struct for guid,
what do I use as names to refer to the fields? I don't think it is clear in
the docs. Can someone correct me?
I'm not entirely comfortable with structures so if I'm being daft please
point that out gently. Thanks.
-Nate
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||