Building XML Output
Whether its an RSS feed or a customized XML feed - creating an output template
that contains XML is straightforward using the CrownPeak CMS development environment. In
practice, it's exactly like creating HTML output, where you use your desired XML tags
instead of HTML tags. The built in escapeItem API function makes sure that
your content is properly escaped. The following code fragment shows
several top level fields and a repeating field:
<name><%= content.escapeItem("name") %></name> <subtitle><%= content.escapeItem("subtitle") %></subtitle> <category>
<% set list = content.createList("categories")
do while list.nextEntry() %>
<category_name><%= list.escapeItem("categories") %></category_name> <% loop %> </category> <class><%= content.escapeItem("class") %></class> <summary><%= content.escapeItem("summary") %></summary> <description><%= content.escapeItem("description") %></description>
|