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

Reply via email to