Handle deep nested complex xml with FreeMarker











up vote
0
down vote

favorite












This is a part of a complex xml template which i put here for the question :



<?xml version="1.0" encoding="UTF-8"?>
<Document>
<CstmrDrctDbtInitn>
<GrpHdr>
<MsgId>${MsgId}</MsgId>
<CreDtTm>${CreDtTm}</CreDtTm>
<NbOfTxs>${NbOfTxs}</NbOfTxs>
<a> ${val1}
<b>
${val2}
</b>
</a>
<CtrlSum>${CtrlSum}</CtrlSum>
</GrpHdr>
<PmtInf>
<PmtInfId>${PmtInfId}</PmtInfId>
<PmtMtd>${PmtMtd}</PmtMtd>
</PmtInf>
<#list persons as person>
</#list>
</CstmrDrctDbtInitn>
</Document>


I have been using FreeMarker for the previous month and until now the xml models have been easy



Searching over the web on how to approach this template , should i create matching java classes (100 of them ? )... should i use Map? like shown here .



I don't have a clue how to do it ... how to apply FreeMarker on this template ?










share|improve this question


















  • 1




    Where does the data coming from? In what format?
    – ddekany
    22 hours ago










  • @ddekany I found an answer below :)
    – GOXR3PLUS
    14 hours ago










  • @ddekany The format is xml , the data is created by us . Consider all the data as String . You are right i missed adding these info :)
    – GOXR3PLUS
    12 hours ago








  • 1




    If you have lot of data in a certain format, you don't have to re-wrap it into hand-made classes. Instead write some generic code that converts them to nested Map-s/List-s, and pass that to the template. Or, since the data is XML, you can directly expose it to template as W3C DOM, since FreeMarker knows how to access that. Last not least, you can extend DefaultObjectWrapper and do whatever magic is needed to expose (even load on demand) your data to templates.
    – ddekany
    2 hours ago












  • @ddekany Excellent thank you sooo much :)
    – GOXR3PLUS
    1 hour ago















up vote
0
down vote

favorite












This is a part of a complex xml template which i put here for the question :



<?xml version="1.0" encoding="UTF-8"?>
<Document>
<CstmrDrctDbtInitn>
<GrpHdr>
<MsgId>${MsgId}</MsgId>
<CreDtTm>${CreDtTm}</CreDtTm>
<NbOfTxs>${NbOfTxs}</NbOfTxs>
<a> ${val1}
<b>
${val2}
</b>
</a>
<CtrlSum>${CtrlSum}</CtrlSum>
</GrpHdr>
<PmtInf>
<PmtInfId>${PmtInfId}</PmtInfId>
<PmtMtd>${PmtMtd}</PmtMtd>
</PmtInf>
<#list persons as person>
</#list>
</CstmrDrctDbtInitn>
</Document>


I have been using FreeMarker for the previous month and until now the xml models have been easy



Searching over the web on how to approach this template , should i create matching java classes (100 of them ? )... should i use Map? like shown here .



I don't have a clue how to do it ... how to apply FreeMarker on this template ?










share|improve this question


















  • 1




    Where does the data coming from? In what format?
    – ddekany
    22 hours ago










  • @ddekany I found an answer below :)
    – GOXR3PLUS
    14 hours ago










  • @ddekany The format is xml , the data is created by us . Consider all the data as String . You are right i missed adding these info :)
    – GOXR3PLUS
    12 hours ago








  • 1




    If you have lot of data in a certain format, you don't have to re-wrap it into hand-made classes. Instead write some generic code that converts them to nested Map-s/List-s, and pass that to the template. Or, since the data is XML, you can directly expose it to template as W3C DOM, since FreeMarker knows how to access that. Last not least, you can extend DefaultObjectWrapper and do whatever magic is needed to expose (even load on demand) your data to templates.
    – ddekany
    2 hours ago












  • @ddekany Excellent thank you sooo much :)
    – GOXR3PLUS
    1 hour ago













up vote
0
down vote

favorite









up vote
0
down vote

favorite











This is a part of a complex xml template which i put here for the question :



<?xml version="1.0" encoding="UTF-8"?>
<Document>
<CstmrDrctDbtInitn>
<GrpHdr>
<MsgId>${MsgId}</MsgId>
<CreDtTm>${CreDtTm}</CreDtTm>
<NbOfTxs>${NbOfTxs}</NbOfTxs>
<a> ${val1}
<b>
${val2}
</b>
</a>
<CtrlSum>${CtrlSum}</CtrlSum>
</GrpHdr>
<PmtInf>
<PmtInfId>${PmtInfId}</PmtInfId>
<PmtMtd>${PmtMtd}</PmtMtd>
</PmtInf>
<#list persons as person>
</#list>
</CstmrDrctDbtInitn>
</Document>


I have been using FreeMarker for the previous month and until now the xml models have been easy



Searching over the web on how to approach this template , should i create matching java classes (100 of them ? )... should i use Map? like shown here .



I don't have a clue how to do it ... how to apply FreeMarker on this template ?










share|improve this question













This is a part of a complex xml template which i put here for the question :



<?xml version="1.0" encoding="UTF-8"?>
<Document>
<CstmrDrctDbtInitn>
<GrpHdr>
<MsgId>${MsgId}</MsgId>
<CreDtTm>${CreDtTm}</CreDtTm>
<NbOfTxs>${NbOfTxs}</NbOfTxs>
<a> ${val1}
<b>
${val2}
</b>
</a>
<CtrlSum>${CtrlSum}</CtrlSum>
</GrpHdr>
<PmtInf>
<PmtInfId>${PmtInfId}</PmtInfId>
<PmtMtd>${PmtMtd}</PmtMtd>
</PmtInf>
<#list persons as person>
</#list>
</CstmrDrctDbtInitn>
</Document>


I have been using FreeMarker for the previous month and until now the xml models have been easy



Searching over the web on how to approach this template , should i create matching java classes (100 of them ? )... should i use Map? like shown here .



I don't have a clue how to do it ... how to apply FreeMarker on this template ?







java freemarker






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked yesterday









GOXR3PLUS

3,08021543




3,08021543








  • 1




    Where does the data coming from? In what format?
    – ddekany
    22 hours ago










  • @ddekany I found an answer below :)
    – GOXR3PLUS
    14 hours ago










  • @ddekany The format is xml , the data is created by us . Consider all the data as String . You are right i missed adding these info :)
    – GOXR3PLUS
    12 hours ago








  • 1




    If you have lot of data in a certain format, you don't have to re-wrap it into hand-made classes. Instead write some generic code that converts them to nested Map-s/List-s, and pass that to the template. Or, since the data is XML, you can directly expose it to template as W3C DOM, since FreeMarker knows how to access that. Last not least, you can extend DefaultObjectWrapper and do whatever magic is needed to expose (even load on demand) your data to templates.
    – ddekany
    2 hours ago












  • @ddekany Excellent thank you sooo much :)
    – GOXR3PLUS
    1 hour ago














  • 1




    Where does the data coming from? In what format?
    – ddekany
    22 hours ago










  • @ddekany I found an answer below :)
    – GOXR3PLUS
    14 hours ago










  • @ddekany The format is xml , the data is created by us . Consider all the data as String . You are right i missed adding these info :)
    – GOXR3PLUS
    12 hours ago








  • 1




    If you have lot of data in a certain format, you don't have to re-wrap it into hand-made classes. Instead write some generic code that converts them to nested Map-s/List-s, and pass that to the template. Or, since the data is XML, you can directly expose it to template as W3C DOM, since FreeMarker knows how to access that. Last not least, you can extend DefaultObjectWrapper and do whatever magic is needed to expose (even load on demand) your data to templates.
    – ddekany
    2 hours ago












  • @ddekany Excellent thank you sooo much :)
    – GOXR3PLUS
    1 hour ago








1




1




Where does the data coming from? In what format?
– ddekany
22 hours ago




Where does the data coming from? In what format?
– ddekany
22 hours ago












@ddekany I found an answer below :)
– GOXR3PLUS
14 hours ago




@ddekany I found an answer below :)
– GOXR3PLUS
14 hours ago












@ddekany The format is xml , the data is created by us . Consider all the data as String . You are right i missed adding these info :)
– GOXR3PLUS
12 hours ago






@ddekany The format is xml , the data is created by us . Consider all the data as String . You are right i missed adding these info :)
– GOXR3PLUS
12 hours ago






1




1




If you have lot of data in a certain format, you don't have to re-wrap it into hand-made classes. Instead write some generic code that converts them to nested Map-s/List-s, and pass that to the template. Or, since the data is XML, you can directly expose it to template as W3C DOM, since FreeMarker knows how to access that. Last not least, you can extend DefaultObjectWrapper and do whatever magic is needed to expose (even load on demand) your data to templates.
– ddekany
2 hours ago






If you have lot of data in a certain format, you don't have to re-wrap it into hand-made classes. Instead write some generic code that converts them to nested Map-s/List-s, and pass that to the template. Or, since the data is XML, you can directly expose it to template as W3C DOM, since FreeMarker knows how to access that. Last not least, you can extend DefaultObjectWrapper and do whatever magic is needed to expose (even load on demand) your data to templates.
– ddekany
2 hours ago














@ddekany Excellent thank you sooo much :)
– GOXR3PLUS
1 hour ago




@ddekany Excellent thank you sooo much :)
– GOXR3PLUS
1 hour ago












1 Answer
1






active

oldest

votes

















up vote
0
down vote













So here is a solution for any future users . Firstly i created 3 models which i am calling like below :



    Map<String, Object> data = new HashMap<>();


//================= Example Creating HeaderVo //=================

HeaderVo header = new HeaderVo("la","la",5,5,"la","la");
data.put("header", header);

//================= Example Creating MiddleVo //=================

MiddleVo middleVo = new MiddleVo("la","la",5,"la","la","la","la");
data.put("middle", middleVo);

//================= Example Creating internal items =================


InternalVo v1 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","EUR");
InternalVo v2 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","DOLLARS");
InternalVo v3 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","LAT");


//List parsing
List<InternalVo> internalVos = new ArrayList<>();
internalVos.add(v1);
internalVos.add(v2);
internalVos.add(v3);
data.put("vos", internalVos);

//================= //================= //================= //=================


final String message = this.templateManager.composeStringFromTemplate(data, "bankfile.ftl");


So below is the bankfile.ftl which represents the complex xml :



```



<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02">
<CstmrDrctDbtInitn>
<GrpHdr>
<MsgId>${header.msgId}</MsgId>
<CreDtTm>${header.creDtTm}</CreDtTm>
<NbOfTxs>${header.nbOfTxs}</NbOfTxs>
<CtrlSum>${header.ctrlSum}</CtrlSum>
<InitgPty>
<Nm>${header.nm}</Nm>
<Id>
<OrgId>
<Othr>
<Id>${header.id}</Id>
</Othr>
</OrgId>
</Id>
</InitgPty>
</GrpHdr>
<PmtInf>
<PmtTpInf>
<SvcLvl>
<Cd>${middle.svcLvlCD}</Cd>
</SvcLvl>
<LclInstrm>
<Cd>${middle.lclInstrmCD}</Cd>
</LclInstrm>
<SeqTp>${middle.seqTp}</SeqTp>
</PmtTpInf>
<ReqdColltnDt>${middle.reqdColltnDt}</ReqdColltnDt>
<Cdtr>
<Nm>${middle.nm}</Nm>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>${middle.iBAN}</IBAN>
</Id>
</CdtrAcct>
<CdtrAgt>
<FinInstnId>
<BIC>${middle.bIC}</BIC>
</FinInstnId>
</CdtrAgt>
<#list vos as vo>
<DrctDbtTxInf> <PmtId> <EndToEndId>${vo.endToEndId}</EndToEndId> </PmtId> <InstdAmt Ccy="${vo.ccy}">${vo.instdAmt}</InstdAmt> <DrctDbtTx> <MndtRltdInf> <MndtId>${vo.mndtId}</MndtId> <DtOfSgntr>${vo.dtOfSgntr}</DtOfSgntr> <AmdmntInd>${vo.amdmntInd?c}</AmdmntInd> </MndtRltdInf> </DrctDbtTx> <DbtrAgt> <FinInstnId> <BIC>${vo.bIC}</BIC> </FinInstnId> </DbtrAgt> <Dbtr> <Nm>${vo.nm}</Nm> </Dbtr> <DbtrAcct> <Id> <IBAN>${vo.iBAN}</IBAN> </Id> </DbtrAcct> </DrctDbtTxInf>
</#list>
</PmtInf>
</CstmrDrctDbtInitn>
</Document>


```



And finally here are the 3 models used for the FTL ( sorry for them being huge , i just wanted to so how complex it can get :) ):



HeaderVo



public class HeaderVo {


private String msgId;
private String creDtTm;
private int nbOfTxs;
private int ctrlSum;
private String nm;
private String id;


public HeaderVo() {
super();
}


public HeaderVo(String msgId, String creDtTm, int nbOfTxs, int ctrlSum, String nm, String id) {
super();
this.msgId = msgId;
this.creDtTm = creDtTm;
this.nbOfTxs = nbOfTxs;
this.ctrlSum = ctrlSum;
this.nm = nm;
this.id = id;
}




public String getMsgId() {
return msgId;
}


public void setMsgId(String msgId) {
this.msgId = msgId;
}


public String getCreDtTm() {
return creDtTm;
}


public void setCreDtTm(String creDtTm) {
this.creDtTm = creDtTm;
}


public int getNbOfTxs() {
return nbOfTxs;
}


public void setNbOfTxs(int nbOfTxs) {
this.nbOfTxs = nbOfTxs;
}


public int getCtrlSum() {
return ctrlSum;
}


public void setCtrlSum(int ctrlSum) {
this.ctrlSum = ctrlSum;
}


public String getNm() {
return nm;
}


public void setNm(String nm) {
this.nm = nm;
}


public String getId() {
return id;
}


public void setId(String id) {
this.id = id;
}


}




MiddleVo



public class MiddleVo {

private String svcLvlCD;
private String lclInstrmCD;
private int seqTp;
private String reqdColltnDt;
private String nm;
private String iBAN;
private String bIC;

public MiddleVo() {
super();

}

public MiddleVo(String svcLvlCD, String lclInstrmCD, int seqTp, String reqdColltnDt, String nm, String iBAN,
String bIC) {
super();
this.svcLvlCD = svcLvlCD;
this.lclInstrmCD = lclInstrmCD;
this.seqTp = seqTp;
this.reqdColltnDt = reqdColltnDt;
this.nm = nm;
this.iBAN = iBAN;
this.bIC = bIC;
}

public String getSvcLvlCD() {
return svcLvlCD;
}

public void setSvcLvlCD(String svcLvlCD) {
this.svcLvlCD = svcLvlCD;
}

public String getLclInstrmCD() {
return lclInstrmCD;
}

public void setLclInstrmCD(String lclInstrmCD) {
this.lclInstrmCD = lclInstrmCD;
}

public int getSeqTp() {
return seqTp;
}

public void setSeqTp(int seqTp) {
this.seqTp = seqTp;
}

public String getReqdColltnDt() {
return reqdColltnDt;
}

public void setReqdColltnDt(String reqdColltnDt) {
this.reqdColltnDt = reqdColltnDt;
}

public String getNm() {
return nm;
}

public void setNm(String nm) {
this.nm = nm;
}

public String getiBAN() {
return iBAN;
}

public void setiBAN(String iBAN) {
this.iBAN = iBAN;
}

public String getbIC() {
return bIC;
}

public void setbIC(String bIC) {
this.bIC = bIC;
}

}




InternalVo



public class InternalVo {

private int endToEndId;
private int instdAmt;
private int mndtId;
private String dtOfSgntr;
private boolean amdmntInd;
private String bIC;
private String nm;
private String iBAN;
private String ccy;


public InternalVo() {
super();
}



public InternalVo(int endToEndId, int instdAmt, int mndtId, String dtOfSgntr, boolean amdmntInd, String bIC, String nm,
String iBAN,String ccy) {
super();
this.endToEndId = endToEndId;
this.instdAmt = instdAmt;
this.mndtId = mndtId;
this.dtOfSgntr = dtOfSgntr;
this.amdmntInd = amdmntInd;
this.bIC = bIC;
this.nm = nm;
this.iBAN = iBAN;
this.ccy = ccy;
}



public int getEndToEndId() {
return endToEndId;
}

public void setEndToEndId(int endToEndId) {
this.endToEndId = endToEndId;
}

public int getInstdAmt() {
return instdAmt;
}

public void setInstdAmt(int instdAmt) {
this.instdAmt = instdAmt;
}

public int getMndtId() {
return mndtId;
}

public void setMndtId(int mndtId) {
this.mndtId = mndtId;
}

public String getDtOfSgntr() {
return dtOfSgntr;
}

public void setDtOfSgntr(String dtOfSgntr) {
this.dtOfSgntr = dtOfSgntr;
}

public boolean isAmdmntInd() {
return amdmntInd;
}

public void setAmdmntInd(boolean amdmntInd) {
this.amdmntInd = amdmntInd;
}

public String getbIC() {
return bIC;
}

public void setbIC(String bIC) {
this.bIC = bIC;
}

public String getNm() {
return nm;
}

public void setNm(String nm) {
this.nm = nm;
}

public String getiBAN() {
return iBAN;
}

public void setiBAN(String iBAN) {
this.iBAN = iBAN;
}

public String getCcy() {
return ccy;
}



public void setCcy(String ccy) {
this.ccy = ccy;
}





share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372366%2fhandle-deep-nested-complex-xml-with-freemarker%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    So here is a solution for any future users . Firstly i created 3 models which i am calling like below :



        Map<String, Object> data = new HashMap<>();


    //================= Example Creating HeaderVo //=================

    HeaderVo header = new HeaderVo("la","la",5,5,"la","la");
    data.put("header", header);

    //================= Example Creating MiddleVo //=================

    MiddleVo middleVo = new MiddleVo("la","la",5,"la","la","la","la");
    data.put("middle", middleVo);

    //================= Example Creating internal items =================


    InternalVo v1 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","EUR");
    InternalVo v2 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","DOLLARS");
    InternalVo v3 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","LAT");


    //List parsing
    List<InternalVo> internalVos = new ArrayList<>();
    internalVos.add(v1);
    internalVos.add(v2);
    internalVos.add(v3);
    data.put("vos", internalVos);

    //================= //================= //================= //=================


    final String message = this.templateManager.composeStringFromTemplate(data, "bankfile.ftl");


    So below is the bankfile.ftl which represents the complex xml :



    ```



    <?xml version="1.0" encoding="UTF-8"?>
    <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02">
    <CstmrDrctDbtInitn>
    <GrpHdr>
    <MsgId>${header.msgId}</MsgId>
    <CreDtTm>${header.creDtTm}</CreDtTm>
    <NbOfTxs>${header.nbOfTxs}</NbOfTxs>
    <CtrlSum>${header.ctrlSum}</CtrlSum>
    <InitgPty>
    <Nm>${header.nm}</Nm>
    <Id>
    <OrgId>
    <Othr>
    <Id>${header.id}</Id>
    </Othr>
    </OrgId>
    </Id>
    </InitgPty>
    </GrpHdr>
    <PmtInf>
    <PmtTpInf>
    <SvcLvl>
    <Cd>${middle.svcLvlCD}</Cd>
    </SvcLvl>
    <LclInstrm>
    <Cd>${middle.lclInstrmCD}</Cd>
    </LclInstrm>
    <SeqTp>${middle.seqTp}</SeqTp>
    </PmtTpInf>
    <ReqdColltnDt>${middle.reqdColltnDt}</ReqdColltnDt>
    <Cdtr>
    <Nm>${middle.nm}</Nm>
    </Cdtr>
    <CdtrAcct>
    <Id>
    <IBAN>${middle.iBAN}</IBAN>
    </Id>
    </CdtrAcct>
    <CdtrAgt>
    <FinInstnId>
    <BIC>${middle.bIC}</BIC>
    </FinInstnId>
    </CdtrAgt>
    <#list vos as vo>
    <DrctDbtTxInf> <PmtId> <EndToEndId>${vo.endToEndId}</EndToEndId> </PmtId> <InstdAmt Ccy="${vo.ccy}">${vo.instdAmt}</InstdAmt> <DrctDbtTx> <MndtRltdInf> <MndtId>${vo.mndtId}</MndtId> <DtOfSgntr>${vo.dtOfSgntr}</DtOfSgntr> <AmdmntInd>${vo.amdmntInd?c}</AmdmntInd> </MndtRltdInf> </DrctDbtTx> <DbtrAgt> <FinInstnId> <BIC>${vo.bIC}</BIC> </FinInstnId> </DbtrAgt> <Dbtr> <Nm>${vo.nm}</Nm> </Dbtr> <DbtrAcct> <Id> <IBAN>${vo.iBAN}</IBAN> </Id> </DbtrAcct> </DrctDbtTxInf>
    </#list>
    </PmtInf>
    </CstmrDrctDbtInitn>
    </Document>


    ```



    And finally here are the 3 models used for the FTL ( sorry for them being huge , i just wanted to so how complex it can get :) ):



    HeaderVo



    public class HeaderVo {


    private String msgId;
    private String creDtTm;
    private int nbOfTxs;
    private int ctrlSum;
    private String nm;
    private String id;


    public HeaderVo() {
    super();
    }


    public HeaderVo(String msgId, String creDtTm, int nbOfTxs, int ctrlSum, String nm, String id) {
    super();
    this.msgId = msgId;
    this.creDtTm = creDtTm;
    this.nbOfTxs = nbOfTxs;
    this.ctrlSum = ctrlSum;
    this.nm = nm;
    this.id = id;
    }




    public String getMsgId() {
    return msgId;
    }


    public void setMsgId(String msgId) {
    this.msgId = msgId;
    }


    public String getCreDtTm() {
    return creDtTm;
    }


    public void setCreDtTm(String creDtTm) {
    this.creDtTm = creDtTm;
    }


    public int getNbOfTxs() {
    return nbOfTxs;
    }


    public void setNbOfTxs(int nbOfTxs) {
    this.nbOfTxs = nbOfTxs;
    }


    public int getCtrlSum() {
    return ctrlSum;
    }


    public void setCtrlSum(int ctrlSum) {
    this.ctrlSum = ctrlSum;
    }


    public String getNm() {
    return nm;
    }


    public void setNm(String nm) {
    this.nm = nm;
    }


    public String getId() {
    return id;
    }


    public void setId(String id) {
    this.id = id;
    }


    }




    MiddleVo



    public class MiddleVo {

    private String svcLvlCD;
    private String lclInstrmCD;
    private int seqTp;
    private String reqdColltnDt;
    private String nm;
    private String iBAN;
    private String bIC;

    public MiddleVo() {
    super();

    }

    public MiddleVo(String svcLvlCD, String lclInstrmCD, int seqTp, String reqdColltnDt, String nm, String iBAN,
    String bIC) {
    super();
    this.svcLvlCD = svcLvlCD;
    this.lclInstrmCD = lclInstrmCD;
    this.seqTp = seqTp;
    this.reqdColltnDt = reqdColltnDt;
    this.nm = nm;
    this.iBAN = iBAN;
    this.bIC = bIC;
    }

    public String getSvcLvlCD() {
    return svcLvlCD;
    }

    public void setSvcLvlCD(String svcLvlCD) {
    this.svcLvlCD = svcLvlCD;
    }

    public String getLclInstrmCD() {
    return lclInstrmCD;
    }

    public void setLclInstrmCD(String lclInstrmCD) {
    this.lclInstrmCD = lclInstrmCD;
    }

    public int getSeqTp() {
    return seqTp;
    }

    public void setSeqTp(int seqTp) {
    this.seqTp = seqTp;
    }

    public String getReqdColltnDt() {
    return reqdColltnDt;
    }

    public void setReqdColltnDt(String reqdColltnDt) {
    this.reqdColltnDt = reqdColltnDt;
    }

    public String getNm() {
    return nm;
    }

    public void setNm(String nm) {
    this.nm = nm;
    }

    public String getiBAN() {
    return iBAN;
    }

    public void setiBAN(String iBAN) {
    this.iBAN = iBAN;
    }

    public String getbIC() {
    return bIC;
    }

    public void setbIC(String bIC) {
    this.bIC = bIC;
    }

    }




    InternalVo



    public class InternalVo {

    private int endToEndId;
    private int instdAmt;
    private int mndtId;
    private String dtOfSgntr;
    private boolean amdmntInd;
    private String bIC;
    private String nm;
    private String iBAN;
    private String ccy;


    public InternalVo() {
    super();
    }



    public InternalVo(int endToEndId, int instdAmt, int mndtId, String dtOfSgntr, boolean amdmntInd, String bIC, String nm,
    String iBAN,String ccy) {
    super();
    this.endToEndId = endToEndId;
    this.instdAmt = instdAmt;
    this.mndtId = mndtId;
    this.dtOfSgntr = dtOfSgntr;
    this.amdmntInd = amdmntInd;
    this.bIC = bIC;
    this.nm = nm;
    this.iBAN = iBAN;
    this.ccy = ccy;
    }



    public int getEndToEndId() {
    return endToEndId;
    }

    public void setEndToEndId(int endToEndId) {
    this.endToEndId = endToEndId;
    }

    public int getInstdAmt() {
    return instdAmt;
    }

    public void setInstdAmt(int instdAmt) {
    this.instdAmt = instdAmt;
    }

    public int getMndtId() {
    return mndtId;
    }

    public void setMndtId(int mndtId) {
    this.mndtId = mndtId;
    }

    public String getDtOfSgntr() {
    return dtOfSgntr;
    }

    public void setDtOfSgntr(String dtOfSgntr) {
    this.dtOfSgntr = dtOfSgntr;
    }

    public boolean isAmdmntInd() {
    return amdmntInd;
    }

    public void setAmdmntInd(boolean amdmntInd) {
    this.amdmntInd = amdmntInd;
    }

    public String getbIC() {
    return bIC;
    }

    public void setbIC(String bIC) {
    this.bIC = bIC;
    }

    public String getNm() {
    return nm;
    }

    public void setNm(String nm) {
    this.nm = nm;
    }

    public String getiBAN() {
    return iBAN;
    }

    public void setiBAN(String iBAN) {
    this.iBAN = iBAN;
    }

    public String getCcy() {
    return ccy;
    }



    public void setCcy(String ccy) {
    this.ccy = ccy;
    }





    share|improve this answer

























      up vote
      0
      down vote













      So here is a solution for any future users . Firstly i created 3 models which i am calling like below :



          Map<String, Object> data = new HashMap<>();


      //================= Example Creating HeaderVo //=================

      HeaderVo header = new HeaderVo("la","la",5,5,"la","la");
      data.put("header", header);

      //================= Example Creating MiddleVo //=================

      MiddleVo middleVo = new MiddleVo("la","la",5,"la","la","la","la");
      data.put("middle", middleVo);

      //================= Example Creating internal items =================


      InternalVo v1 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","EUR");
      InternalVo v2 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","DOLLARS");
      InternalVo v3 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","LAT");


      //List parsing
      List<InternalVo> internalVos = new ArrayList<>();
      internalVos.add(v1);
      internalVos.add(v2);
      internalVos.add(v3);
      data.put("vos", internalVos);

      //================= //================= //================= //=================


      final String message = this.templateManager.composeStringFromTemplate(data, "bankfile.ftl");


      So below is the bankfile.ftl which represents the complex xml :



      ```



      <?xml version="1.0" encoding="UTF-8"?>
      <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02">
      <CstmrDrctDbtInitn>
      <GrpHdr>
      <MsgId>${header.msgId}</MsgId>
      <CreDtTm>${header.creDtTm}</CreDtTm>
      <NbOfTxs>${header.nbOfTxs}</NbOfTxs>
      <CtrlSum>${header.ctrlSum}</CtrlSum>
      <InitgPty>
      <Nm>${header.nm}</Nm>
      <Id>
      <OrgId>
      <Othr>
      <Id>${header.id}</Id>
      </Othr>
      </OrgId>
      </Id>
      </InitgPty>
      </GrpHdr>
      <PmtInf>
      <PmtTpInf>
      <SvcLvl>
      <Cd>${middle.svcLvlCD}</Cd>
      </SvcLvl>
      <LclInstrm>
      <Cd>${middle.lclInstrmCD}</Cd>
      </LclInstrm>
      <SeqTp>${middle.seqTp}</SeqTp>
      </PmtTpInf>
      <ReqdColltnDt>${middle.reqdColltnDt}</ReqdColltnDt>
      <Cdtr>
      <Nm>${middle.nm}</Nm>
      </Cdtr>
      <CdtrAcct>
      <Id>
      <IBAN>${middle.iBAN}</IBAN>
      </Id>
      </CdtrAcct>
      <CdtrAgt>
      <FinInstnId>
      <BIC>${middle.bIC}</BIC>
      </FinInstnId>
      </CdtrAgt>
      <#list vos as vo>
      <DrctDbtTxInf> <PmtId> <EndToEndId>${vo.endToEndId}</EndToEndId> </PmtId> <InstdAmt Ccy="${vo.ccy}">${vo.instdAmt}</InstdAmt> <DrctDbtTx> <MndtRltdInf> <MndtId>${vo.mndtId}</MndtId> <DtOfSgntr>${vo.dtOfSgntr}</DtOfSgntr> <AmdmntInd>${vo.amdmntInd?c}</AmdmntInd> </MndtRltdInf> </DrctDbtTx> <DbtrAgt> <FinInstnId> <BIC>${vo.bIC}</BIC> </FinInstnId> </DbtrAgt> <Dbtr> <Nm>${vo.nm}</Nm> </Dbtr> <DbtrAcct> <Id> <IBAN>${vo.iBAN}</IBAN> </Id> </DbtrAcct> </DrctDbtTxInf>
      </#list>
      </PmtInf>
      </CstmrDrctDbtInitn>
      </Document>


      ```



      And finally here are the 3 models used for the FTL ( sorry for them being huge , i just wanted to so how complex it can get :) ):



      HeaderVo



      public class HeaderVo {


      private String msgId;
      private String creDtTm;
      private int nbOfTxs;
      private int ctrlSum;
      private String nm;
      private String id;


      public HeaderVo() {
      super();
      }


      public HeaderVo(String msgId, String creDtTm, int nbOfTxs, int ctrlSum, String nm, String id) {
      super();
      this.msgId = msgId;
      this.creDtTm = creDtTm;
      this.nbOfTxs = nbOfTxs;
      this.ctrlSum = ctrlSum;
      this.nm = nm;
      this.id = id;
      }




      public String getMsgId() {
      return msgId;
      }


      public void setMsgId(String msgId) {
      this.msgId = msgId;
      }


      public String getCreDtTm() {
      return creDtTm;
      }


      public void setCreDtTm(String creDtTm) {
      this.creDtTm = creDtTm;
      }


      public int getNbOfTxs() {
      return nbOfTxs;
      }


      public void setNbOfTxs(int nbOfTxs) {
      this.nbOfTxs = nbOfTxs;
      }


      public int getCtrlSum() {
      return ctrlSum;
      }


      public void setCtrlSum(int ctrlSum) {
      this.ctrlSum = ctrlSum;
      }


      public String getNm() {
      return nm;
      }


      public void setNm(String nm) {
      this.nm = nm;
      }


      public String getId() {
      return id;
      }


      public void setId(String id) {
      this.id = id;
      }


      }




      MiddleVo



      public class MiddleVo {

      private String svcLvlCD;
      private String lclInstrmCD;
      private int seqTp;
      private String reqdColltnDt;
      private String nm;
      private String iBAN;
      private String bIC;

      public MiddleVo() {
      super();

      }

      public MiddleVo(String svcLvlCD, String lclInstrmCD, int seqTp, String reqdColltnDt, String nm, String iBAN,
      String bIC) {
      super();
      this.svcLvlCD = svcLvlCD;
      this.lclInstrmCD = lclInstrmCD;
      this.seqTp = seqTp;
      this.reqdColltnDt = reqdColltnDt;
      this.nm = nm;
      this.iBAN = iBAN;
      this.bIC = bIC;
      }

      public String getSvcLvlCD() {
      return svcLvlCD;
      }

      public void setSvcLvlCD(String svcLvlCD) {
      this.svcLvlCD = svcLvlCD;
      }

      public String getLclInstrmCD() {
      return lclInstrmCD;
      }

      public void setLclInstrmCD(String lclInstrmCD) {
      this.lclInstrmCD = lclInstrmCD;
      }

      public int getSeqTp() {
      return seqTp;
      }

      public void setSeqTp(int seqTp) {
      this.seqTp = seqTp;
      }

      public String getReqdColltnDt() {
      return reqdColltnDt;
      }

      public void setReqdColltnDt(String reqdColltnDt) {
      this.reqdColltnDt = reqdColltnDt;
      }

      public String getNm() {
      return nm;
      }

      public void setNm(String nm) {
      this.nm = nm;
      }

      public String getiBAN() {
      return iBAN;
      }

      public void setiBAN(String iBAN) {
      this.iBAN = iBAN;
      }

      public String getbIC() {
      return bIC;
      }

      public void setbIC(String bIC) {
      this.bIC = bIC;
      }

      }




      InternalVo



      public class InternalVo {

      private int endToEndId;
      private int instdAmt;
      private int mndtId;
      private String dtOfSgntr;
      private boolean amdmntInd;
      private String bIC;
      private String nm;
      private String iBAN;
      private String ccy;


      public InternalVo() {
      super();
      }



      public InternalVo(int endToEndId, int instdAmt, int mndtId, String dtOfSgntr, boolean amdmntInd, String bIC, String nm,
      String iBAN,String ccy) {
      super();
      this.endToEndId = endToEndId;
      this.instdAmt = instdAmt;
      this.mndtId = mndtId;
      this.dtOfSgntr = dtOfSgntr;
      this.amdmntInd = amdmntInd;
      this.bIC = bIC;
      this.nm = nm;
      this.iBAN = iBAN;
      this.ccy = ccy;
      }



      public int getEndToEndId() {
      return endToEndId;
      }

      public void setEndToEndId(int endToEndId) {
      this.endToEndId = endToEndId;
      }

      public int getInstdAmt() {
      return instdAmt;
      }

      public void setInstdAmt(int instdAmt) {
      this.instdAmt = instdAmt;
      }

      public int getMndtId() {
      return mndtId;
      }

      public void setMndtId(int mndtId) {
      this.mndtId = mndtId;
      }

      public String getDtOfSgntr() {
      return dtOfSgntr;
      }

      public void setDtOfSgntr(String dtOfSgntr) {
      this.dtOfSgntr = dtOfSgntr;
      }

      public boolean isAmdmntInd() {
      return amdmntInd;
      }

      public void setAmdmntInd(boolean amdmntInd) {
      this.amdmntInd = amdmntInd;
      }

      public String getbIC() {
      return bIC;
      }

      public void setbIC(String bIC) {
      this.bIC = bIC;
      }

      public String getNm() {
      return nm;
      }

      public void setNm(String nm) {
      this.nm = nm;
      }

      public String getiBAN() {
      return iBAN;
      }

      public void setiBAN(String iBAN) {
      this.iBAN = iBAN;
      }

      public String getCcy() {
      return ccy;
      }



      public void setCcy(String ccy) {
      this.ccy = ccy;
      }





      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        So here is a solution for any future users . Firstly i created 3 models which i am calling like below :



            Map<String, Object> data = new HashMap<>();


        //================= Example Creating HeaderVo //=================

        HeaderVo header = new HeaderVo("la","la",5,5,"la","la");
        data.put("header", header);

        //================= Example Creating MiddleVo //=================

        MiddleVo middleVo = new MiddleVo("la","la",5,"la","la","la","la");
        data.put("middle", middleVo);

        //================= Example Creating internal items =================


        InternalVo v1 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","EUR");
        InternalVo v2 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","DOLLARS");
        InternalVo v3 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","LAT");


        //List parsing
        List<InternalVo> internalVos = new ArrayList<>();
        internalVos.add(v1);
        internalVos.add(v2);
        internalVos.add(v3);
        data.put("vos", internalVos);

        //================= //================= //================= //=================


        final String message = this.templateManager.composeStringFromTemplate(data, "bankfile.ftl");


        So below is the bankfile.ftl which represents the complex xml :



        ```



        <?xml version="1.0" encoding="UTF-8"?>
        <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02">
        <CstmrDrctDbtInitn>
        <GrpHdr>
        <MsgId>${header.msgId}</MsgId>
        <CreDtTm>${header.creDtTm}</CreDtTm>
        <NbOfTxs>${header.nbOfTxs}</NbOfTxs>
        <CtrlSum>${header.ctrlSum}</CtrlSum>
        <InitgPty>
        <Nm>${header.nm}</Nm>
        <Id>
        <OrgId>
        <Othr>
        <Id>${header.id}</Id>
        </Othr>
        </OrgId>
        </Id>
        </InitgPty>
        </GrpHdr>
        <PmtInf>
        <PmtTpInf>
        <SvcLvl>
        <Cd>${middle.svcLvlCD}</Cd>
        </SvcLvl>
        <LclInstrm>
        <Cd>${middle.lclInstrmCD}</Cd>
        </LclInstrm>
        <SeqTp>${middle.seqTp}</SeqTp>
        </PmtTpInf>
        <ReqdColltnDt>${middle.reqdColltnDt}</ReqdColltnDt>
        <Cdtr>
        <Nm>${middle.nm}</Nm>
        </Cdtr>
        <CdtrAcct>
        <Id>
        <IBAN>${middle.iBAN}</IBAN>
        </Id>
        </CdtrAcct>
        <CdtrAgt>
        <FinInstnId>
        <BIC>${middle.bIC}</BIC>
        </FinInstnId>
        </CdtrAgt>
        <#list vos as vo>
        <DrctDbtTxInf> <PmtId> <EndToEndId>${vo.endToEndId}</EndToEndId> </PmtId> <InstdAmt Ccy="${vo.ccy}">${vo.instdAmt}</InstdAmt> <DrctDbtTx> <MndtRltdInf> <MndtId>${vo.mndtId}</MndtId> <DtOfSgntr>${vo.dtOfSgntr}</DtOfSgntr> <AmdmntInd>${vo.amdmntInd?c}</AmdmntInd> </MndtRltdInf> </DrctDbtTx> <DbtrAgt> <FinInstnId> <BIC>${vo.bIC}</BIC> </FinInstnId> </DbtrAgt> <Dbtr> <Nm>${vo.nm}</Nm> </Dbtr> <DbtrAcct> <Id> <IBAN>${vo.iBAN}</IBAN> </Id> </DbtrAcct> </DrctDbtTxInf>
        </#list>
        </PmtInf>
        </CstmrDrctDbtInitn>
        </Document>


        ```



        And finally here are the 3 models used for the FTL ( sorry for them being huge , i just wanted to so how complex it can get :) ):



        HeaderVo



        public class HeaderVo {


        private String msgId;
        private String creDtTm;
        private int nbOfTxs;
        private int ctrlSum;
        private String nm;
        private String id;


        public HeaderVo() {
        super();
        }


        public HeaderVo(String msgId, String creDtTm, int nbOfTxs, int ctrlSum, String nm, String id) {
        super();
        this.msgId = msgId;
        this.creDtTm = creDtTm;
        this.nbOfTxs = nbOfTxs;
        this.ctrlSum = ctrlSum;
        this.nm = nm;
        this.id = id;
        }




        public String getMsgId() {
        return msgId;
        }


        public void setMsgId(String msgId) {
        this.msgId = msgId;
        }


        public String getCreDtTm() {
        return creDtTm;
        }


        public void setCreDtTm(String creDtTm) {
        this.creDtTm = creDtTm;
        }


        public int getNbOfTxs() {
        return nbOfTxs;
        }


        public void setNbOfTxs(int nbOfTxs) {
        this.nbOfTxs = nbOfTxs;
        }


        public int getCtrlSum() {
        return ctrlSum;
        }


        public void setCtrlSum(int ctrlSum) {
        this.ctrlSum = ctrlSum;
        }


        public String getNm() {
        return nm;
        }


        public void setNm(String nm) {
        this.nm = nm;
        }


        public String getId() {
        return id;
        }


        public void setId(String id) {
        this.id = id;
        }


        }




        MiddleVo



        public class MiddleVo {

        private String svcLvlCD;
        private String lclInstrmCD;
        private int seqTp;
        private String reqdColltnDt;
        private String nm;
        private String iBAN;
        private String bIC;

        public MiddleVo() {
        super();

        }

        public MiddleVo(String svcLvlCD, String lclInstrmCD, int seqTp, String reqdColltnDt, String nm, String iBAN,
        String bIC) {
        super();
        this.svcLvlCD = svcLvlCD;
        this.lclInstrmCD = lclInstrmCD;
        this.seqTp = seqTp;
        this.reqdColltnDt = reqdColltnDt;
        this.nm = nm;
        this.iBAN = iBAN;
        this.bIC = bIC;
        }

        public String getSvcLvlCD() {
        return svcLvlCD;
        }

        public void setSvcLvlCD(String svcLvlCD) {
        this.svcLvlCD = svcLvlCD;
        }

        public String getLclInstrmCD() {
        return lclInstrmCD;
        }

        public void setLclInstrmCD(String lclInstrmCD) {
        this.lclInstrmCD = lclInstrmCD;
        }

        public int getSeqTp() {
        return seqTp;
        }

        public void setSeqTp(int seqTp) {
        this.seqTp = seqTp;
        }

        public String getReqdColltnDt() {
        return reqdColltnDt;
        }

        public void setReqdColltnDt(String reqdColltnDt) {
        this.reqdColltnDt = reqdColltnDt;
        }

        public String getNm() {
        return nm;
        }

        public void setNm(String nm) {
        this.nm = nm;
        }

        public String getiBAN() {
        return iBAN;
        }

        public void setiBAN(String iBAN) {
        this.iBAN = iBAN;
        }

        public String getbIC() {
        return bIC;
        }

        public void setbIC(String bIC) {
        this.bIC = bIC;
        }

        }




        InternalVo



        public class InternalVo {

        private int endToEndId;
        private int instdAmt;
        private int mndtId;
        private String dtOfSgntr;
        private boolean amdmntInd;
        private String bIC;
        private String nm;
        private String iBAN;
        private String ccy;


        public InternalVo() {
        super();
        }



        public InternalVo(int endToEndId, int instdAmt, int mndtId, String dtOfSgntr, boolean amdmntInd, String bIC, String nm,
        String iBAN,String ccy) {
        super();
        this.endToEndId = endToEndId;
        this.instdAmt = instdAmt;
        this.mndtId = mndtId;
        this.dtOfSgntr = dtOfSgntr;
        this.amdmntInd = amdmntInd;
        this.bIC = bIC;
        this.nm = nm;
        this.iBAN = iBAN;
        this.ccy = ccy;
        }



        public int getEndToEndId() {
        return endToEndId;
        }

        public void setEndToEndId(int endToEndId) {
        this.endToEndId = endToEndId;
        }

        public int getInstdAmt() {
        return instdAmt;
        }

        public void setInstdAmt(int instdAmt) {
        this.instdAmt = instdAmt;
        }

        public int getMndtId() {
        return mndtId;
        }

        public void setMndtId(int mndtId) {
        this.mndtId = mndtId;
        }

        public String getDtOfSgntr() {
        return dtOfSgntr;
        }

        public void setDtOfSgntr(String dtOfSgntr) {
        this.dtOfSgntr = dtOfSgntr;
        }

        public boolean isAmdmntInd() {
        return amdmntInd;
        }

        public void setAmdmntInd(boolean amdmntInd) {
        this.amdmntInd = amdmntInd;
        }

        public String getbIC() {
        return bIC;
        }

        public void setbIC(String bIC) {
        this.bIC = bIC;
        }

        public String getNm() {
        return nm;
        }

        public void setNm(String nm) {
        this.nm = nm;
        }

        public String getiBAN() {
        return iBAN;
        }

        public void setiBAN(String iBAN) {
        this.iBAN = iBAN;
        }

        public String getCcy() {
        return ccy;
        }



        public void setCcy(String ccy) {
        this.ccy = ccy;
        }





        share|improve this answer












        So here is a solution for any future users . Firstly i created 3 models which i am calling like below :



            Map<String, Object> data = new HashMap<>();


        //================= Example Creating HeaderVo //=================

        HeaderVo header = new HeaderVo("la","la",5,5,"la","la");
        data.put("header", header);

        //================= Example Creating MiddleVo //=================

        MiddleVo middleVo = new MiddleVo("la","la",5,"la","la","la","la");
        data.put("middle", middleVo);

        //================= Example Creating internal items =================


        InternalVo v1 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","EUR");
        InternalVo v2 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","DOLLARS");
        InternalVo v3 = new InternalVo(5, 5, 5, "s", true, "zz", "zzzz", "ll","LAT");


        //List parsing
        List<InternalVo> internalVos = new ArrayList<>();
        internalVos.add(v1);
        internalVos.add(v2);
        internalVos.add(v3);
        data.put("vos", internalVos);

        //================= //================= //================= //=================


        final String message = this.templateManager.composeStringFromTemplate(data, "bankfile.ftl");


        So below is the bankfile.ftl which represents the complex xml :



        ```



        <?xml version="1.0" encoding="UTF-8"?>
        <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02">
        <CstmrDrctDbtInitn>
        <GrpHdr>
        <MsgId>${header.msgId}</MsgId>
        <CreDtTm>${header.creDtTm}</CreDtTm>
        <NbOfTxs>${header.nbOfTxs}</NbOfTxs>
        <CtrlSum>${header.ctrlSum}</CtrlSum>
        <InitgPty>
        <Nm>${header.nm}</Nm>
        <Id>
        <OrgId>
        <Othr>
        <Id>${header.id}</Id>
        </Othr>
        </OrgId>
        </Id>
        </InitgPty>
        </GrpHdr>
        <PmtInf>
        <PmtTpInf>
        <SvcLvl>
        <Cd>${middle.svcLvlCD}</Cd>
        </SvcLvl>
        <LclInstrm>
        <Cd>${middle.lclInstrmCD}</Cd>
        </LclInstrm>
        <SeqTp>${middle.seqTp}</SeqTp>
        </PmtTpInf>
        <ReqdColltnDt>${middle.reqdColltnDt}</ReqdColltnDt>
        <Cdtr>
        <Nm>${middle.nm}</Nm>
        </Cdtr>
        <CdtrAcct>
        <Id>
        <IBAN>${middle.iBAN}</IBAN>
        </Id>
        </CdtrAcct>
        <CdtrAgt>
        <FinInstnId>
        <BIC>${middle.bIC}</BIC>
        </FinInstnId>
        </CdtrAgt>
        <#list vos as vo>
        <DrctDbtTxInf> <PmtId> <EndToEndId>${vo.endToEndId}</EndToEndId> </PmtId> <InstdAmt Ccy="${vo.ccy}">${vo.instdAmt}</InstdAmt> <DrctDbtTx> <MndtRltdInf> <MndtId>${vo.mndtId}</MndtId> <DtOfSgntr>${vo.dtOfSgntr}</DtOfSgntr> <AmdmntInd>${vo.amdmntInd?c}</AmdmntInd> </MndtRltdInf> </DrctDbtTx> <DbtrAgt> <FinInstnId> <BIC>${vo.bIC}</BIC> </FinInstnId> </DbtrAgt> <Dbtr> <Nm>${vo.nm}</Nm> </Dbtr> <DbtrAcct> <Id> <IBAN>${vo.iBAN}</IBAN> </Id> </DbtrAcct> </DrctDbtTxInf>
        </#list>
        </PmtInf>
        </CstmrDrctDbtInitn>
        </Document>


        ```



        And finally here are the 3 models used for the FTL ( sorry for them being huge , i just wanted to so how complex it can get :) ):



        HeaderVo



        public class HeaderVo {


        private String msgId;
        private String creDtTm;
        private int nbOfTxs;
        private int ctrlSum;
        private String nm;
        private String id;


        public HeaderVo() {
        super();
        }


        public HeaderVo(String msgId, String creDtTm, int nbOfTxs, int ctrlSum, String nm, String id) {
        super();
        this.msgId = msgId;
        this.creDtTm = creDtTm;
        this.nbOfTxs = nbOfTxs;
        this.ctrlSum = ctrlSum;
        this.nm = nm;
        this.id = id;
        }




        public String getMsgId() {
        return msgId;
        }


        public void setMsgId(String msgId) {
        this.msgId = msgId;
        }


        public String getCreDtTm() {
        return creDtTm;
        }


        public void setCreDtTm(String creDtTm) {
        this.creDtTm = creDtTm;
        }


        public int getNbOfTxs() {
        return nbOfTxs;
        }


        public void setNbOfTxs(int nbOfTxs) {
        this.nbOfTxs = nbOfTxs;
        }


        public int getCtrlSum() {
        return ctrlSum;
        }


        public void setCtrlSum(int ctrlSum) {
        this.ctrlSum = ctrlSum;
        }


        public String getNm() {
        return nm;
        }


        public void setNm(String nm) {
        this.nm = nm;
        }


        public String getId() {
        return id;
        }


        public void setId(String id) {
        this.id = id;
        }


        }




        MiddleVo



        public class MiddleVo {

        private String svcLvlCD;
        private String lclInstrmCD;
        private int seqTp;
        private String reqdColltnDt;
        private String nm;
        private String iBAN;
        private String bIC;

        public MiddleVo() {
        super();

        }

        public MiddleVo(String svcLvlCD, String lclInstrmCD, int seqTp, String reqdColltnDt, String nm, String iBAN,
        String bIC) {
        super();
        this.svcLvlCD = svcLvlCD;
        this.lclInstrmCD = lclInstrmCD;
        this.seqTp = seqTp;
        this.reqdColltnDt = reqdColltnDt;
        this.nm = nm;
        this.iBAN = iBAN;
        this.bIC = bIC;
        }

        public String getSvcLvlCD() {
        return svcLvlCD;
        }

        public void setSvcLvlCD(String svcLvlCD) {
        this.svcLvlCD = svcLvlCD;
        }

        public String getLclInstrmCD() {
        return lclInstrmCD;
        }

        public void setLclInstrmCD(String lclInstrmCD) {
        this.lclInstrmCD = lclInstrmCD;
        }

        public int getSeqTp() {
        return seqTp;
        }

        public void setSeqTp(int seqTp) {
        this.seqTp = seqTp;
        }

        public String getReqdColltnDt() {
        return reqdColltnDt;
        }

        public void setReqdColltnDt(String reqdColltnDt) {
        this.reqdColltnDt = reqdColltnDt;
        }

        public String getNm() {
        return nm;
        }

        public void setNm(String nm) {
        this.nm = nm;
        }

        public String getiBAN() {
        return iBAN;
        }

        public void setiBAN(String iBAN) {
        this.iBAN = iBAN;
        }

        public String getbIC() {
        return bIC;
        }

        public void setbIC(String bIC) {
        this.bIC = bIC;
        }

        }




        InternalVo



        public class InternalVo {

        private int endToEndId;
        private int instdAmt;
        private int mndtId;
        private String dtOfSgntr;
        private boolean amdmntInd;
        private String bIC;
        private String nm;
        private String iBAN;
        private String ccy;


        public InternalVo() {
        super();
        }



        public InternalVo(int endToEndId, int instdAmt, int mndtId, String dtOfSgntr, boolean amdmntInd, String bIC, String nm,
        String iBAN,String ccy) {
        super();
        this.endToEndId = endToEndId;
        this.instdAmt = instdAmt;
        this.mndtId = mndtId;
        this.dtOfSgntr = dtOfSgntr;
        this.amdmntInd = amdmntInd;
        this.bIC = bIC;
        this.nm = nm;
        this.iBAN = iBAN;
        this.ccy = ccy;
        }



        public int getEndToEndId() {
        return endToEndId;
        }

        public void setEndToEndId(int endToEndId) {
        this.endToEndId = endToEndId;
        }

        public int getInstdAmt() {
        return instdAmt;
        }

        public void setInstdAmt(int instdAmt) {
        this.instdAmt = instdAmt;
        }

        public int getMndtId() {
        return mndtId;
        }

        public void setMndtId(int mndtId) {
        this.mndtId = mndtId;
        }

        public String getDtOfSgntr() {
        return dtOfSgntr;
        }

        public void setDtOfSgntr(String dtOfSgntr) {
        this.dtOfSgntr = dtOfSgntr;
        }

        public boolean isAmdmntInd() {
        return amdmntInd;
        }

        public void setAmdmntInd(boolean amdmntInd) {
        this.amdmntInd = amdmntInd;
        }

        public String getbIC() {
        return bIC;
        }

        public void setbIC(String bIC) {
        this.bIC = bIC;
        }

        public String getNm() {
        return nm;
        }

        public void setNm(String nm) {
        this.nm = nm;
        }

        public String getiBAN() {
        return iBAN;
        }

        public void setiBAN(String iBAN) {
        this.iBAN = iBAN;
        }

        public String getCcy() {
        return ccy;
        }



        public void setCcy(String ccy) {
        this.ccy = ccy;
        }






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        GOXR3PLUS

        3,08021543




        3,08021543






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372366%2fhandle-deep-nested-complex-xml-with-freemarker%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

            Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

            A Topological Invariant for $pi_3(U(n))$