sandip has asked for the wisdom of the Perl Monks concerning the following question:
In xml file i have following data where some tags like<ChrgBr> may not be present in every next file. So i want these values to be stored in some variable like var1="405360,00" , var2="DEBT" and so on ,but if <ChrgBr> tag has no value or is absent var2 should have space like var2=" " so that i can put the if condition to print only present varable values in the flat file
SAMPLE DATA XML FILE:1
<IntrBkSttlmAmt Ccy="USD">405360,00</IntrBkSttlmAmt> <ChrgBr>DEBT</ChrgBr> <ChrgsInf> <Amt Ccy=>00.00</Amt> <Agt> <FinInstnId> <ClrSysMmbId> <MmbId>BRANCHNO1</MmbId> </ClrSysMmbId> </FinInstnId> </Agt> </ChrgsInf> <c> <p> SAMPLE DATA XML FILE :2 </p> <c> <IntrBkSttlmAmt Ccy="USD">405360,00</IntrBkSttlmAmt> <ChrgsInf> <Amt Ccy=>00.00</Amt> <Agt> <FinInstnId> <ClrSysMmbId> <MmbId>BRANCHNO1</MmbId> </ClrSysMmbId> </FinInstnId> </Agt> </ChrgsInf>
OUTPUT SAMPLE DATA FLAT FILE :1
var1="405360,00" var2="DEBT" var3="00.00" var4="BRANCHNO1"
OUTPUT SAMPLE DATA FLAT FILE :2
var1="405360,00" var2=" " var3="00.00" var4="BRANCHNO1"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML PARSING of dynamic xml file to flat file
by McA (Priest) on Aug 08, 2013 at 12:38 UTC | |
by sandip (Initiate) on Aug 08, 2013 at 13:39 UTC | |
by McA (Priest) on Aug 08, 2013 at 14:19 UTC |