Skip to content

Instantly share code, notes, and snippets.

@knice
Created February 16, 2012 17:34
Show Gist options
  • Select an option

  • Save knice/1846629 to your computer and use it in GitHub Desktop.

Select an option

Save knice/1846629 to your computer and use it in GitHub Desktop.
Atom 1.0 Velocity Script
## Get atom feed from a feed block
#set ($feed = $_XPathTool.selectSingleNode($contentRoot,"/feed"))
## Try to get entries from that feed
#set ($entries = $feed.getChildren())
<ul>
<li>Feed name: $feed.getName()</li>
<li>Size of Entries array: $entries.size()</li>
<li>Feed namespace URI: $contentRoot.namespace.URI</li>
</ul>
<div class="contentBox from-format">
#if($entries.size() >= 1)
<ul>
#foreach ($item in $entries)
#if($item.getName() == "entry")
#set ($title = $item.getChild("title").text)
<li>
$_SerializerTool.serialize($title, true)
</li>
#end
#end
</ul>
#end
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment