Please help in solving this map. Here I have XML with HDR, DTL, FTR; The DTL have ITEM-BANK, ITEM-BANK, ITEM-BANK detail in pair together. I need to flatten this to output in one record.
BUSINESS RULE:
- 1) If ID element is empty it is then COMMENT and will be aggregated "Address of Party + Zipcode of Party + Postbus of Party" in COMMENT output XML.
- 2) If ID is BANK then it has bank details, and TAG element ID has ID value refer to above ITEM.
XSD POCProducts : http://pastebin.com/XNaq40vZ
POC MAP
EXPECTED/WANTED OUTOUT:
<ns0:PRODUCTS xmlns:ns0="http://TEST.Schema.FlatFile.POCProducts"> <PRODUCT ProdName="Wonder Power" ProdDesc="Wonder power DESC"> <ITEMS> <ITEMS> <ID>1010</ID> <CODE>KG</CODE> <UNIT>C0001</UNIT> <DESC>Wonder Power 10*10ml</DESC> <BankCode>A1</BankCode> <BankDesc>Bank XXXX Code</BankDesc> </ITEMS> <ITEMS> <ID>2020</ID> <CODE>KG</CODE> <UNIT>C0001</UNIT> <DESC>Wonder Supper 50*50ml</DESC> <BankCode>A2</BankCode> <BankDesc>Bank yyyyy Code</BankDesc> </ITEMS> </ITEMS> <VAT>5390</VAT> <AMT>880099</AMT> <Comment>Address of Party + Zipcode of Party + Postbus of Party</Comment> </PRODUCT> </ns0:PRODUCTS>
CURRENT OUTPUT XML:
<ns0:PRODUCTS xmlns:ns0="http://TEST.Schema.FlatFile.POCProducts"> <PRODUCT ProdName="Wonder Power" ProdDesc="Wonder power DESC"> <ITEMS> <ITEMS> <ID>1010</ID> <CODE>KG</CODE> <UNIT>C0001</UNIT> <DESC>Wonder Power 10*10ml</DESC> </ITEMS> <ITEMS> <ID>2020</ID> <CODE>KG</CODE> <UNIT>C0001</UNIT> <DESC>Wonder Supper 50*50ml</DESC> </ITEMS> </ITEMS> <VAT>5390</VAT> <AMT>880099</AMT> </PRODUCT> </ns0:PRODUCTS>
INPUT XML:
<POC xmlns="http://TEST.Schema.FlatFile.POC"> <HDR xmlns=""> <ProdName>Wonder Power</ProdName> <ProdDesc>Wonder power DESC</ProdDesc> <Filler></Filler> </HDR> <DTL xmlns=""> <ID>1010</ID> <CODE>KG</CODE> <TAG>C0001</TAG> <DESC>Wonder Power 10*10ml</DESC> <FILLER></FILLER> </DTL> <DTL xmlns=""> <ID>BANK</ID> <CODE>A1</CODE> <TAG>1010</TAG> <DESC>Bank XXXX Code</DESC> <FILLER></FILLER> </DTL> <DTL xmlns=""> <ID>2020</ID> <CODE>KG</CODE> <TAG>C0001</TAG> <DESC>Wonder Supper 50*50ml</DESC> <FILLER></FILLER> </DTL> <DTL xmlns=""> <ID>BANK</ID> <CODE>A2</CODE> <TAG>2020</TAG> <DESC>Bank yyyyy Code</DESC> <FILLER></FILLER> </DTL> <DTL xmlns=""> <ID></ID> <CODE></CODE> <TAG>Address of Party</TAG> <DESC></DESC> <FILLER></FILLER> </DTL> <DTL xmlns=""> <ID></ID> <CODE></CODE> <TAG></TAG> <DESC>Zipcode of Party</DESC> <FILLER></FILLER> </DTL> <DTL xmlns=""> <ID></ID> <CODE></CODE> <TAG></TAG> <DESC>Postbus of Party</DESC> <FILLER></FILLER> </DTL> <FTR xmlns=""> <VAT>5390</VAT> <TOTAL>880099</TOTAL> <FILLER></FILLER> </FTR> </POC>
Thanks
- Edited by NimAnsari 19 hours 45 minutes ago