| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Groovy example source code file (AtomTestScript.groovy)

This example Groovy source code file (AtomTestScript.groovy) is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

entry, entry, feed, feed, leung, list, markupbuilder, person, person, string, string, ted

The Groovy AtomTestScript.groovy source code

package groovy.script

import groovy.xml.MarkupBuilder;

/** note you could use Expando classes if you don't mind being dynamically typed 
f = new Expando() = new Expando(name:'Ted Leung',url:'', email:'')

f.entries = [ new Expando(title:'one',summary:'first post'), new Expando(title:'two',summary:'the second post'), new Expando(title:'three', summary:'post the third'), new Expando(title:'four',summary:'the ponderous fourth post') ]

f = new Feed() = new Person(name:'Ted Leung',url:'', email:'')

f.entries = [ new Entry(title:'one',summary:'first post'), new Entry(title:'two',summary:'the second post'), new Entry(title:'three', summary:'post the third'), new Entry(title:'four',summary:'the ponderous fourth post') ]

f.entries.each { println it.title }

xml = new MarkupBuilder()

atom = xml.atom() {
  title("Ted Leung off the air")
  author() {
    person() {

  for (e in f.entries) {
    entry() {

class Feed {
    String title
    String link
    Person author
    String tagline
    String generator
    String copyright
    String modified
    List entries

class Entry {
    String title
    String link
    String id
    String summary
    String content
    Person author
    String created
    String issued
    String modified

class Person {
    String name
    String url
    String email

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy AtomTestScript.groovy source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.