shell menggunakan loop untuk menambahkan elemen dalam file xml di PowerShell

$xmlFragment=$log.CreateDocumentFragment()
$clients = 'Sample1.com','Sample2.com'    
$targets = $log.selectnodes('//Data')

for ($i = 0; $i -lt $targets.Count; $i++) {
    $rows = $targets[$i].selectnodes(".//Row")
    $item = $clients[$i]
    $new_node = "<client>$item</client>"    
    foreach ($row in $rows) {
        $xmlFragment.InnerXML=$new_node
        $row.PrependChild($xmlFragment)
    }
}
SAMER SAEID