I have the following powershell code. It basically creates a template, that I then use to populate with XML data.
$template = @'
<?xml version="1.0" encoding="UTF-8"?>
<list>
<details>
<cj></cj>
<jn></jn>
<en></en>
<st></st>
<et></et>
</details>
</list>
'@
$template | Out-File template.xml -encoding UTF8
$xml = New-Object xml
$xml.Load("template.xml")
It works fine, but I was wondering if there was a cleaner way of doing this that doean't involve exporting it to a file and then loading that file back in.
e.g. is there a way of passing $template directly to the $xml (similar to $xml.Load($template) - which doesn't work)
I've had a look around the web, but can't find anything to help - am I just looking in the wrong places? or can it not be done?