title: XML to powershell array
body: <p>I want to load xml content into an array within a powershell script. Why dows this not work? :(</p>
  
  <p>My XML:</p>
  
  <pre><code>&lt;settings&gt;
      &lt;services&gt;
         &lt;sv&gt;service1&lt;/sv&gt;
         &lt;sv&gt;service2&lt;/sv&gt;
      &lt;/services&gt;
  &lt;/settings&gt;
  </code></pre>
  
  <p>My Powershell script. This seems to work, but I'm not sure</p>
  
  <pre><code>[xml]$xml = Get-Content "D:\config.xml"
  [array]$service_arr = $xml.settings.services.sv
  </code></pre>
  
  <p>But now I want to display it, but I get "Cannot index into a null array."</p>
  
  <pre><code>$service_arr[0]
  </code></pre>
  
  <p>I don't really want to have a variable with a different generic name for each service. I only want to be able to address my services with array[0]...array[1] etc.</p>