NVelocity

This is a simple templating tool.

Here is the documentation for the templates.

This is what you need to get NVelocity to work:

NVelocity.Context.IContext context = new VelocityContext();

context.Put(“name”, “Chris”);

NVelocity.Runtime.RuntimeSingleton.Init();
NVelocity.Template template = NVelocity.Runtime.RuntimeSingleton.GetTemplate(“helloworld.vm”);

StringWriter writer = new StringWriter();

template.Merge(context, writer);

Console.WriteLine(writer.ToString());

Here  is the template:

Hello $name!  Welcome to Velocity!

Leave a comment