> OK, Issac, that makes a little more sense.  I'm going to
> re-read the
> whole thing again right now, but if you have that example
> you were
> referring to, I'd love to see it.  Seeing other's examples
> in
> conjunction with the info you just gave should clear this
> all up.  You
> can send it offline to my CrystalVision account.

> Thanks for the explanation.

Heck, I may as well submit it here (sorry it's a little long and may
be a bit confusing, 'cause this sample has a bunch of extra stuff in
it for handling timezones and extra i18n info for the feed, but here
goes):

<cfsavecontent variable="blog.view.rss">
<cfoutput>
<rss version="2.0" xmlns="http://blogs.law.harvard.edu/tech/rss";
xmlns:dc="http://purl.org/dc/elements/1.1/";>
   <item>
      <dc:language>#replace(rsArticle.articlelocale,"_","-","ALL")#</d
c:language>
      <title>#request.tapi.xmlformat(rsArticle.articletitle)#</title>
      <dc:creator>#request.tapi.xmlformat(creator)#</dc:creator>
      <cfif not author.getValue("memberhideemail")>
      <author>#request.tapi.xmlformat(author.getValue("memberemail"))#
</author>
      </cfif>
      <pubDate>#pubDate#</pubDate>
      <link>#request.tapi.xmlformat(articleURL)#</link>
      <guid>#request.tapi.xmlformat(articleURL)#</guid>
      <cfloop query="rsCategory">
      <category
xml:lang="#replace(rsCategory.categorylocale,'_','-','ALL')#">
         #request.tapi.xmlformat(rsCategory.categoryname)#
      </category>
      </cfloop>
      <description>#request.tapi.xmlformat(rsArticle.articletext)#</de
scription>
   </item>
</rss>
</cfoutput>
</cfsavecontent>

I've cut everything other than the individual blog article item tag
out of the packet here. The pubDate isn't formatted because I know the
format for that date will be valid XML (format is specified by RSS).
Unfortunately I don't have an already built RSS packet to show you for
comparison, so I'll just fake it here. Now, when this packet gets
built, the description node at the bottom of the item looks like this
if the user entered xhtml content:

<description>
&lt;p&gt;this is a paragraph&lt;/p&gt;
&lt;p&gt;this is another paragraph&lt;/p&gt;
</description>

Now when I take that XML packet and deserialize it with XmlParse() and
output #item.description.xmlText# on the page, the code output will
then look like

<p>this is a paragraph</p>
<p>this is another paragraph</p>

Conversely, if I had created the RSS packet with XmlElemNew()
statements, the comparable code to generate that description node
would be

description = XmlElemNew("description",RSSDoc);
description.xmlText = rsArticle.articleText;
arrayAppend(item.xmlChildren,description);

Note that I didn't XmlFormat() the article text in this example. In
this CFML the description node is a Java object. When that object is
converted to a text string with toString() (in CF7 you can omit the
toString()) it automatically escapes the entities in that text node
because it was inserted as a text node instead of being inserted as an
array of other xml nodes, so the xml object is going to preserve its
status as a text node by escaping any special characters it finds
there.

s. isaac dealey     434.293.6201
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234702
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to