We initialize the encoding property directly in the call parameters of the New-Object. Please note that the name of the -properties parameter is not necessary to write completely, as long as there is no other parameter starting with the same letters.
The reduction to the XML type is performed using the [xml] line before the expression, and not before the variable - just to get to the necessary data immediately, and not to repeat the path afterwards
Formatting by inserting subexpressions into a string - so we have a primitive template divider in PowerShell right out of the box