AnsweredAssumed Answered

Mapping a xml profile to xml profile. Here depending upon presence of few tags on source xml profile, the target should have the default values assigned and empty tags to be present

Question asked by madhushree.krishnamurthy@logicinfo.com on Jul 29, 2018

In the source xml profile, I have a tag named <option-lineitems> which has child tags under it similar to the example as shown below.

<option-lineitems>

     <net-price> 100 </netprice>

      <gross-price> 150 </gross-price>

      <base-price> 120 </base-price>

      <tax> 30 </tax>

</option-lineitems>.

 

The xml which I am trying to convert may or may not have <option-lineitems> tag, If this particular tag is present in the source xml, Then it the values under <optional-lineitems> needs to be mapped to the target xml. which is similar to

<sale>

<promotion>

<promotion-id>

<taxable-amount>150</taxable-amount>

<tax>30</tax>

</sale>

Where taxable amount and tax have been mapped from source xml and promotion-id has a default value set to it and there is not mapping from source. and promotion tag needs to be present always as an empty tag whenever there option-lineitems tag is present in source. If it is not present the complete sale tag should not be present in  the target xml. How to achieve this?

 

because when I tried, even-though there was no option-lineitems tag, I was getting the default value for promotion-id and the empty tag of promotion 

Outcomes