velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leon Messerschmidt <>
Subject [Proposal] ProcessVisitor Base Class
Date Tue, 29 Aug 2000 12:25:35 GMT

This might be totally the wrong idea, so please correct me if I'm wrong...

I want to use Velocity for XML templates.  I'd like two basic
functionalities for this (1) the ability to replace xml entities when
variables are inserted (2) to get the output through a PrintWriter.  The
rest should be exactly the same.

What I would like to propose is a base class for ProcessVisitor - maybe
something called Processor (??) .  This base class has two abstract methods:

protected void print(String text, int x, int y, int columnAdjustment)
protected String parseVariable (String var)

A derived ProcessVisitor does the same in the print() method and nothing for
the parseVariable() method.  Other visitors that extend the base class can
print to a PrintWriter in the print() method and replace xml entities in the
parseVariable() method.  This way I (and some other people) can add some
speciality functions without duplicating the Processor code.

Does this sound useful or am I completely missing the boat?

If it is worthwhile I'd be happy to implement it.

~ Leon

View raw message