How to add New XMLport Node to our existing XMLport,dynamically?

SuDSuD Member Posts: 102
Hey experts,
Here i need a solution from u guyz.
I have a XML port to import XML file,but problem is here that..XML file which i m gonna to import have some nodes/element that have values on condition base..
eg.<CAD_DETAILS>
<CAD>
<Account>G0183</Account>
<CustomerName>GO INTERNATIONAL</CustomerName>
<invoice_number>
</invoice_number>
<Invoice_Date>
</Invoice_Date>
<Due_Date>
</Due_Date>
<ShipmentDate>01/22/2017</ShipmentDate>
<ShipmentNumber>XJ560665148JF</ShipmentNumber>
<AccountManager>Warren Lee</AccountManager>
<customerref>37560018277</customerref>
<MAWB>16039539080</MAWB>
<Service>ADC</Service>
<Origin>HKG</Origin>
<Dest>ITA</Dest>
<ShipperName>Go International Limited</ShipperName>
<ConsignorAddress>
</ConsignorAddress>
<ConsigneeName>filippo fenili</ConsigneeName>
<ConsigneeTel>35214270</ConsigneeTel>
<ConsigneeAddress>
</ConsigneeAddress>
<receiverZip>24128</receiverZip>
<destName>Italy</destName>
<DestCountry>Italy</DestCountry>
<SentTo>
</SentTo>
<Flight>
</Flight>
<Coloader>DPDCDG</Coloader>
<AlternateNumber>5000953700</AlternateNumber>
<AWB_Counts>1</AWB_Counts>
<Pieces>1</Pieces>
<Pack_Type>N</Pack_Type>
<Weigt>0.480</Weigt>
<VolWeight>0.480</VolWeight>
<ChargeableWeight>0.480</ChargeableWeight>
<Weight_Charge>0.480</Weight_Charge>
<ServiceAmount>96.00</ServiceAmount>
<spotRate>N</spotRate>
<First_0.5>N</First_0.5>
<AAA>N</AAA>
<AAC>Y</AAC>
<AAC_Amount>52</AAC_Amount>

<ADC>Y</ADC>
<ADC_Amount>96.00</ADC_Amount>

<ADCI>N</ADCI>
<ADF>N</ADF>
<ADO>N</ADO>
<AF>N</AF>
</CAD>
</CAD_DETAILS>

in this xml file if AAC have value 'Y',only then the next element will be there AAC_Amount in xml file otherwise not.
How can i handle this kind of situation,becuz if i need to read all XXX_Amount element in my XMLport.

Answers

  • vaprogvaprog Member Posts: 1,139
    edited 2017-01-27
    Hi SuD,

    You can try the UseLax property of the XMLPort, but probably you're more on the secure side not using an XMLPort at all but Dotnet.

    Another approach would be to add all the optional components to the XML before you feed it to the XMLPort, using e.g. an XML Transform.
Sign In or Register to comment.