I am trying to create a Freemarker program to convert XML to JSON . I am not able to read values from the list of values from the repeated tags of a xml . Am not able to figure out why i could not read value from repeated tags .
<#assign DEALS = body[".//DEALS"]>
{
loans: [
<#list DEALS as d>
{
<#assign PROPERTY = d[".//PROPERTY"]>
propAddress1: ${PROPERTY[".//AddressLineText"]}
}
</#list>
]
}
<MESSAGE>
<DEAL_SETS>
<DEALS>
<DEAL>
<PROPERTY>
<ADDRESS>
<AddressLineText>1111</AddressLineText>
</ADDRESS>
</PROPERTY>
</DEAL>
<DEAL>
<PROPERTY>
<ADDRESS>
<AddressLineText>2222</AddressLineText>
</ADDRESS>
</PROPERTY>
</DEAL>
<DEAL>
<PROPERTY>
<ADDRESS>
<AddressLineText>3333</AddressLineText>
</ADDRESS>
</PROPERTY>
</DEAL>
</DEALS>
</DEAL_SET>
</MESSAGE>
Output
{
"loans": []
}
Expected output
{
"loans": [
{propAddress1: 1111},
{propAddress1: 2222},
{propAddress1: 3333}
]
}
Xpath should be .//ADDRESS/AddressLineText