L'esempio seguente, in PowerShell, permette di leggere un file XML e gestirlo come oggetto:
PowerShell
[xml]$x = Get-Content .\Manifest.xml
$f = $x.files.file | ? {$_.show -eq "true"}
$f | % {"$pwd\Files\" + $_.name}
può anche essere scritto come:
PowerShell
([xml](Get-Content .\Manifest.xml)).files.file | ? {$_.show -eq "true"} |  % {"$pwd\Files\" + $_.name}
Notare il cast ad aggetto xml fatto tramite le parentesi quadre [xml]
Potrebbe interessarti anche: