<?xml version="1.0" encoding="UTF-8"?>
<Document>
<FIToFICstmrCdtTrf>
<GrpHdr>
<MsgId>10001</MsgId>
<NbOfTxs>1</NbOfTxs>
<IntrBkSttlmDt>2015-05-06</IntrBkSttlmDt>
<SttlmInf>
<SttlmMtd>CLRG</SttlmMtd>
</SttlmInf>
<PmtTpInf>
<CtgyPurp>
<Cd>CIOO</Cd>
</CtgyPurp>
</PmtTpInf>
<InstgAgt>
<FinInstnId>
<BICFI>JOHNCENA</BICFI>
</FinInstnId>
<BrnchId>
<Id>0313</Id>
</BrnchId>
</InstgAgt>
<SplmtryData>
<Envlp>
<Cnts/>
</Envlp>
</SplmtryData>
</GrpHdr>
<CdtTrfTxInf>
<InstdAgt>
<FinInstnId>
<BICFI>JOSH</BICFI>
</FinInstnId>
</InstdAgt>
<Dbtr>
<Nm>XXXXXXXX XX XXXXXXX</Nm>
<PstlAdr>
<AdrLine>XXXXXXXX XX XXXXXXX</AdrLine>
</PstlAdr>
<Id>
<PrvtId>
<Othr>
<Id/>
</Othr>
</PrvtId>
<OrgId>
<Othr>
<Id/>
</Othr>
</OrgId>
</Id>
</Dbtr>
<DbtrAcct>
<Id>
<Othr>
<Id>0000001065</Id>
</Othr>
</Id>
</DbtrAcct>
<DbtrAgt>
<FinInstnId>
<BICFI>JOHNCENA</BICFI>
</FinInstnId>
<BrnchId>
<Id>0313</Id>
</BrnchId>
</DbtrAgt>
<CdtrAgt>
<FinInstnId>
<BICFI>KHALI</BICFI>
</FinInstnId>
<BrnchId>
<Id/>
</BrnchId>
</CdtrAgt>
<Cdtr>
<Nm>TEST</Nm>
<PstlAdr>
<AdrLine/>
</PstlAdr>
<Id>
<PrvtId>
<Othr>
<Id/>
</Othr>
</PrvtId>
<OrgId>
<Othr>
<Id/>
</Othr>
</OrgId>
</Id>
</Cdtr>
<CdtrAcct>
<Id>
<Othr>
<Id>12434345</Id>
</Othr>
</Id>
</CdtrAcct>
<InstrForCdtrAgt>
<InstrInf>DETAILS 1</InstrInf>
</InstrForCdtrAgt>
<SplmtryData>
<Envlp>
<Cnts>
<Dbtr>
<CustTp>3</CustTp>
<CustRsdt>1</CustRsdt>
</Dbtr>
<Cdtr>
<CustTp>3</CustTp>
<CustRsdt>1</CustRsdt>
</Cdtr>
<PrdCnfrm/>
</Cnts>
</Envlp>
</SplmtryData>
</CdtTrfTxInf>
</FIToFICstmrCdtTrf>
</Document>
I have this file wherein at line 109 , there is a tag <Dbtr> followed by tag <CustTp> at line 110 , I want to check if the tag value for <CustTp> is 1 then have only <PrvtId> section from line 43 to 47 inside <Dbtr> tag section from line 37 to 54 and delete <OrgId> section from line 48 to 52.
if the tag value for <CustTp> is 2 or 3 then have only <OrgId> section from line 48 to 52 and delete <PrvtId> section from line 43 to 47 inside <Dbtr> tag section from line 37 to 54 .
Same logic I need to apply for <CustTp> tag inside <Cdtr> tag section on line 113 , in that I need to do the changes in the <Cdtr> section from line 78-95 on basis of value inside <CustTp> tag.
Kindly note that <CdtTrfTxInf> is repeating element , so we can have n number of <CdtTrfTxInf> inside an XML file.
Regards,
Harish