[prev in list] [next in list] [prev in thread] [next in thread] 

List:       velocity-user
Subject:    RE: Texen or dvsl
From:       "didge" <didge () foundrylogic ! com>
Date:       2003-04-15 0:22:22
[Download RAW message or body]

I may be coming late to the party, but here's my comments anyway :)

I haven't used DVSL or Jelly, but I have used Texen and I wrote VPP (with
input and help from this community).

Texen is a useful but low level utility that is best when you don't mind
writing Java code to populate the context.  In addition, you must write a
'control template' to drive processing as the ant task wrapper is just
enough to launch your Texen subclass, but doesn't do a whole lot else.

I've used Texen very successfully as a tool to transform database metadata
into an XML representation for an OR mapping generator.

VPP (vpp.sourceforge.net) is a preprocessor driven by Apache Ant.  It's
functionality is exposed in three ways:
vppcopy - a replacement for Ant's copy task that preprocesses each file
before copying
vppjavac - a replacement for Ant's javac task that preprocesses each file
before compiling
vppfilter - a filterchain class, useful if you want to embed velocity style
preprocessing in a filterchain
Unlike Texen, VPP doesn't require a control template, doesn't require any
Java coding to use, and allows you to populate your context from your Ant
buildfile directly.

In summary, Texen requires a subclass to configure its context and is best
when you have a static 'control template' used for generation.  VPP doesn't
require any Java coding and works lets you process a dynamic set of
templates selected using Ant's file selection capabilities.

Here's a quick example based on Peter Kazmier's jelly example, but using
VPP:

Build file:

<project name="example" basedir="." default="vppcopy">
	<target name="vppDefs" >
		<typedef resource="foundrylogic/vpp/typedef.properties" />
		<taskdef resource="foundrylogic/vpp/taskdef.properties" />
	</target>

	<target name="vppcopy" depends="vppDefs">
		<vppcopy todir="output" overwrite="true">
			<vppconfig>
				<velocitycontext>
					<tool key="calendar" classname="java.util.GregorianCalendar"/>
					<property key="name" value="Peter Kazmier"/>
					<property key="age" value="29"/>
				</velocitycontext>
			</vppconfig>
			<fileset dir="src" includes="*.html.vpp"/>
			<mapper type="glob" from="*.html.vpp" to="*.html"/>
		</vppcopy>
	</target>

Template:

  My name is $name, and I am ${project.getProperty("age")} years old.
  Today is $calendar.time.

Result:

  My name is Pete Kazmier, and I am 29 years old.
  Today is Mon Apr 14 17:06:13 PDT 2003.

VPP can also parse and include Java property files (actually Apache
ExtendedProperty files) into the context, but does not currently have the
capability to parse and include an XML document (a la Jelly), a very useful
feature, probably one that I will add shortly.

didge


> -----Original Message-----
> From: Warner Onstine [mailto:sw-list@warneronstine.com]
> Sent: Tuesday, April 08, 2003 1:46 PM
> To: Velocity Users List
> Subject: Texen or dvsl
>
>
> Hi all,
> I am getting ready to write a PHP code generation tool and have
> been trying
> to decide what to use, Texen or DVSL.
>
> This tool will generate PHP classes and some generic forms and action
> handlers, based on xml configuration files. So, which tool is the best to
> use in this situation.
>
> Thanks in advance,
> Warner
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic