Hi,
Use as below
#foreach($elem in $rootelem.getChildren())##
   #set ($elemname = $elem.getName())##
   #set( $sometext = $userprops.get($elemname)  )##
   #set($tempVariable = $elem.setText( $sometext ))##
#end##

to ignore the return value from setText, just pretend as assigning to a
variable ( its the way i used in my templates). If anyone has a better way
to ignore such unneccesary return values from printing, pls let me know.

For unnecessary new lines, in your for loop, there will be new lines each
after a statement. So if you put ## i.e comment as EOL, it will ignore those
new lines. There are lot of bugs reported for formatting and new lines in
velocity. Please go through the forum mails for further reference.

Regards,
Ravi

On 2/7/06, Anagha <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I'm building the XML in the VTL.
> At some point I retrieve the value of an element and set its text as
> $elem.setText( $sometext )
>
> #foreach($elem in $rootelem.getChildren())
>    #set ($elemname = $elem.getName())
>    #set( $sometext = $userprops.get($elemname)  )
>    $elem.setText( $sometext )
>
> #end
>
> In the output I get each element printed as --- "[Element:
> <serviceName/>]"
> where serviceName is the the element name.
> This happens for all the elements in the for loop. I want to disable this
> output on the console/file which comes from "setText"
>
> I tried :
> VelocityEngine ve = new VelocityEngine();
> ve.setProperty(VelocityEngine.VM_MESSAGES_ON, "false");
>
> But still the elements are printed which is not desired.
> Also I get a lot of new lines in the output which I want to disable.
>
> Any pointers?
> --
> Thanks & Regards,
> Anagha
>
>

Reply via email to