Return-Path: Mailing-List: contact velocity-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list velocity-user@jakarta.apache.org Received: (qmail 83677 invoked from network); 29 Aug 2000 13:14:02 -0000 Received: from jhb-proxy.mweb.co.za (196.2.48.243) by locus.apache.org with SMTP; 29 Aug 2000 13:14:02 -0000 Received: from taurus ([196.31.184.86]) by jhb-proxy.mweb.co.za (Sun Internet Mail Server sims.3.5.2000.03.23.18.03.p10) with SMTP id <0G0200IR8102DS@jhb-proxy.mweb.co.za> for velocity-user@jakarta.apache.org; Tue, 29 Aug 2000 14:50:30 +0200 (GMT-2) Date: Tue, 29 Aug 2000 14:25:35 +0200 From: Leon Messerschmidt Subject: [Proposal] ProcessVisitor Base Class To: velocity-user@jakarta.apache.org Message-id: <001801c011b9$64343960$0100a8c0@taurus> MIME-version: 1.0 X-Mailer: Microsoft Outlook Express 5.00.2919.6700 Content-type: text/plain; charset="iso-8859-1" Content-transfer-encoding: 7bit X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Priority: 3 X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Hi, 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