Let us suppose that i have an array with 5 elements in it.
$fruits[$a] - {fox,apple,tiger,lion,rose}
i want these items to be fetched from this array and to be printed in an XML file in the following format :
<elements>
<elements scope="items">fox</elements>
<elements scope="items">apple</elements>
<elements scope="items">tiger</elements>
<elements scope="items">lion</elements>
<elements scope="items">rose</elements>
</elements>
I am unable to fetch the data in the above mentioned format... instead by my script i am getting the elements in the following format (which is not required)
<elements>
<elements scope="items">fox apple tiger lion rose[0]</elements>
<elements scope="items">fox apple tiger lion rose[1]</elements>
<elements scope="items">fox apple tiger lion rose[2]</elements>
<elements scope="items">fox apple tiger lion rose[3]</elements>
<elements scope="items">fox apple tiger lion rose[4]</elements>
</elements>
I've tried
For($a=0;$a -lt $elements;$a++) {
$arte[$a] = Split-Path $arte[$a]-Leaf $global:xmlWriter.WriteRaw("<elements scope="items">$arte[$a]</elements>") #Write-Host $arte[$a];
}