Getting data from XML and sending to CSV

I have a text file (parts.txt) that contains a list of part names e.g.


I then have an XML file that contains these part names and from this file, for each part name I need to extract the values for price1, price2 and price3. Extract from the top of the XML file included below.

Once these values have been extracted I need to send the total for each price1-3 to a CSV file.

Any help appreciated.

This will export the part name and a price total for each.

# Get Part Numbers
$partnumbers = Get-Content .\parts.txt
# Get XML file
[xml]$productxml = Get-Content .\product.xml

# Get details for each partnumber
$partsobj = {@()}.Invoke()
foreach ($num in $partnumbers){
 $Total = $ | Where-Object {$_.part_name -eq $num} | Select-Object price* | Measure-Object -Property * -Sum | 
 Measure-Object -Property Sum -Sum
 $price = [pscustomobject]@{'Part Number'=$num;Total=$Total.Sum}
 } # End Foreach
$partsobj | Export-Csv .\partstotals.csv -NoTypeInformation -Append

Hi, this works a treat but I’ve just found out that there are a number of the XML files created with an older format. The differences in the XML format are: