Re: Unable to convert the data to xml

Claude Brisson <[email protected]> Wed, 28 Jun 2023 02:08:58 +0200
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <[email protected]>
Oh, and : please read the Velocity Template Language syntax: you cannot 
use parenthesis or spaces like you do.

On 28/06/2023 01:58, Claude Brisson wrote:
> Please don't copy paste your templates like this, it's not useful. You 
> are getting variable names just because your context is not properly 
> populated. Without any further description of how you call Velocity, 
> it is difficult to help you.
>
>
> On 25/05/2023 14:48, narasimha gudisa wrote:
>> Hello, I have data in the excel file I would like to convert the data to
>> the xml format using the apache velocity transformation engine.
>>
>> My template  :
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <root>
>> #foreach ($line in $data)
>> <row>
>>      <timestamp type = "string">$(line.Timestamp(optional))</timestamp>
>>   <targettype type = "string">$line.Target Type</targettype>
>> <targetname type = "string">$line.Target Name</targetname>
>> <blockingevent type = "string">$line.Blocking
>> Event(optional)</blockingevent>
>>   <message type = "string">$line.Message</message>
>>
>> </row>
>> #end
>> </root>
>>
>> Getting the output :
>>
>> <root>
>> <row>
>> <timestamp type="string">$(line.Timestamp(optional))</timestamp>
>> <targettype type="string">$line.Target Type</targettype>
>> <targetname type="string">$line.Target Name</targetname>
>> <blockingevent type="string">$line.Blocking 
>> Event(optional)</blockingevent>
>> <message type="string">$line.Message</message>
>> </row>
>> <row>
>> <timestamp type="string">$(line.Timestamp(optional))</timestamp>
>> <targettype type="string">$line.Target Type</targettype>
>> <targetname type="string">$line.Target Name</targetname>
>> <blockingevent type="string">$line.Blocking 
>> Event(optional)</blockingevent>
>> <message type="string">$line.Message</message>
>> </row>
>> <row>
>> <timestamp type="string">$(line.Timestamp(optional))</timestamp>
>> <targettype type="string">$line.Target Type</targettype>
>> <targetname type="string">$line.Target Name</targetname>
>> <blockingevent type="string">$line.Blocking 
>> Event(optional)</blockingevent>
>> <message type="string">$line.Message</message>
>> </row>
>> <row>
>> <timestamp type="string">$(line.Timestamp(optional))</timestamp>
>> <targettype type="string">$line.Target Type</targettype>
>> <targetname type="string">$line.Target Name</targetname>
>> <blockingevent type="string">$line.Blocking 
>> Event(optional)</blockingevent>
>> <message type="string">$line.Message</message>
>> </row>
>> <row>
>> <timestamp type="string">$(line.Timestamp(optional))</timestamp>
>> <targettype type="string">$line.Target Type</targettype>
>> <targetname type="string">$line.Target Name</targetname>
>> <blockingevent type="string">$line.Blocking 
>> Event(optional)</blockingevent>
>> <message type="string">$line.Message</message>
>> </row>
>> <row>
>> <timestamp type="string">$(line.Timestamp(optional))</timestamp>
>> <targettype type="string">$line.Target Type</targettype>
>> <targetname type="string">$line.Target Name</targetname>
>> <blockingevent type="string">$line.Blocking 
>> Event(optional)</blockingevent>
>> <message type="string">$line.Message</message>
>> </row>
>> <row>
>> <timestamp type="string">$(line.Timestamp(optional))</timestamp>
>> <targettype type="string">$line.Target Type</targettype>
>> <targetname type="string">$line.Target Name</targetname>
>> <blockingevent type="string">$line.Blocking 
>> Event(optional)</blockingevent>
>> <message type="string">$line.Message</message>
>> </row>
>> <row>
>> <timestamp type="string">$(line.Timestamp(optional))</timestamp>
>> <targettype type="string">$line.Target Type</targettype>
>> <targetname type="string">$line.Target Name</targetname>
>> <blockingevent type="string">$line.Blocking 
>> Event(optional)</blockingevent>
>> <message type="string">$line.Message</message>
>> </row>
>> <row>
>> <timestamp type="string">$(line.Timestamp(optional))</timestamp>
>> <targettype type="string">$line.Target Type</targettype>
>> <targetname type="string">$line.Target Name</targetname>
>> <blockingevent type="string">$line.Blocking 
>> Event(optional)</blockingevent>
>> <message type="string">$line.Message</message>
>> </row>
>> <row>
>> <timestamp type="string">$(line.Timestamp(optional))</timestamp>
>> <targettype type="string">$line.Target Type</targettype>
>> <targetname type="string">$line.Target Name</targetname>
>> <blockingevent type="string">$line.Blocking 
>> Event(optional)</blockingevent>
>> <message type="string">$line.Message</message>
>> </row>
>> </root>
>>
>> I'm getting the variable names instead of data can you help me 
>> achieve this
>>
>> Thanks in advance
>>
>> Thanks
>> Narasimha Gudisa
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>