I have a XML like this below and want to create a script, which reads all tracking numbers, maybe in an array, save them. Then the script should delete all <TrackingNumber>- lines, insert only one line <TrackingNumber> in section <TrackingNumbers>, which contains the saved tracking numbers from the array. Can anybody help me here ?<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<ShipmentInformation>
<Document No="S006122">
<ShipmentDate>2020-07-30T00:00:00</ShipmentDate>
<LanguageCode />
<CustomerInformation>
<ExternalDocumentNo>4501779882</ExternalDocumentNo>
</CustomerInformation>
<InvoiceAddress>
<CustomerNo>138321110</CustomerNo>
<ContactNo>KT435379</ContactNo>
<CustomerName>Name1</CustomerName>
<Address>Street2</Address>
<PostCode>12345</PostCode>
<City>City1</City>
<CountryCode>DE</CountryCode>
</InvoiceAddress>
<ShipmentAddress>
<CustomerName>Nam2</CustomerName>
<Address>Mr.Bond</Address>
<Address2>Street2</Address2>
<PostCode>54321</PostCode>
<City>City2</City>
<CountryCode>DE</CountryCode>
</ShipmentAddress>
<TrackingNumbers>
<ShippingAgent>DHL</ShippingAgent>
<TrackingNumber>1Z5686016811115412</TrackingNumber>
<TrackingNumber>1Z5686016811115226</TrackingNumber>
<TrackingNumber>1Z5686016811112635</TrackingNumber>
<TrackingNumber>1Z5686016811113640</TrackingNumber>
<TrackingNumber>1Z5686016811114250</TrackingNumber>
<TrackingNumber>1Z5686016811110460</TrackingNumber>
</TrackingNumbers>
</Document>
</ShipmentInformation>
Result should be:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<ShipmentInformation>
<Document No="S006122">
<ShipmentDate>2020-07-30T00:00:00</ShipmentDate>
<LanguageCode />
<CustomerInformation>
<ExternalDocumentNo>4501779882</ExternalDocumentNo>
</CustomerInformation>
<InvoiceAddress>
<CustomerNo>138321110</CustomerNo>
<ContactNo>KT435379</ContactNo>
<CustomerName>Name1</CustomerName>
<Address>Street2</Address>
<PostCode>12345</PostCode>
<City>City1</City>
<CountryCode>DE</CountryCode>
</InvoiceAddress>
<ShipmentAddress>
<CustomerName>Nam2</CustomerName>
<Address>Mr.Bond</Address>
<Address2>Street2</Address2>
<PostCode>54321</PostCode>
<City>City2</City>
<CountryCode>DE</CountryCode>
</ShipmentAddress>
<TrackingNumbers>
<ShippingAgent>DHL</ShippingAgent> <TrackingNumber>1Z5686016811115412,1Z5686016811115226,1Z5686016811112635,1Z5686016811113640,1Z5686016811114250,1Z5686016811110460</TrackingNumber>
</TrackingNumbers>
</Document>
</ShipmentInformation>