String templateText =
"<html><head>\n"+
"<body>\n"+
"This is some text.\n"+
"<!-- TEMPLATE:foo -->\n"+
"Some more text.\n"+
"\n"+
"<!--template:bar This is text -->\n"+
"More text.\n"+
"<!-- TEMPLATE:bar \n"+
"-->\n"+
"</body></html>\n";
Template template = new Template();
template.set( "foo", "FooTemplate");
template.set( "bar", "BarTemplate");
System.out.println( templateText );
System.out.println( template.fillIn(templateText) );