title: Powershell xml accessing key pair value
body: <p>I have this sample xml file in the following format. How do I access the value for a key directly using Powershell?</p>
  
  <p>Eg: $xml.array.dict.key.name -> bob, kate, john</p>
  
  <pre><code>$xml = @'
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;plist version="1.0"&gt;
  &lt;array&gt;
      &lt;dict&gt;
          &lt;key&gt;name&lt;/key&gt;
          &lt;string&gt;bob&lt;/string&gt;
          &lt;key&gt;age&lt;/key&gt;
          &lt;string&gt;35&lt;/string&gt;
          &lt;key&gt;gender&lt;/key&gt;
          &lt;string&gt;male&lt;/string&gt;
      &lt;/dict&gt;
      &lt;dict&gt;
          &lt;key&gt;name&lt;/key&gt;
          &lt;string&gt;kate&lt;/string&gt;
          &lt;key&gt;age&lt;/key&gt;
          &lt;string&gt;12&lt;/string&gt;
          &lt;key&gt;gender&lt;/key&gt;
          &lt;string&gt;female&lt;/string&gt;
      &lt;/dict&gt;
      &lt;dict&gt;
          &lt;key&gt;name&lt;/key&gt;
          &lt;string&gt;john&lt;/string&gt;
          &lt;key&gt;age&lt;/key&gt;
          &lt;string&gt;57&lt;/string&gt;
          &lt;key&gt;gender&lt;/key&gt;
          &lt;string&gt;male&lt;/string&gt;
      &lt;/dict&gt;
  &lt;/array&gt;
  &lt;/plist&gt;
  '@
  </code></pre>
  
  <p>How do I convert the xml into Powershell Objects like the following?</p>
  
  <p><strong>Output</strong></p>
  
  <pre><code>name   age   gender
  ---    --    -----
  bob    35    male
  kate   12    female
  john   57    male
  </code></pre>
  
  <p>This is what I have tried.</p>
  
  <pre><code>$xmldata = [xml]$xml
  $xmldict = $xmldata.plist.array.dict
  $xmldict
  </code></pre>
  
  <p>This gives the output</p>
  
  <pre><code>key                                    string
  ---                                    ------
  {name, age, gender}                    {bob, 35, male}
  {name, age, gender}                    {kate, 12, female}
  {name, age, gender}                    {john, 57, male}
  </code></pre>
  
  <p><strong>$xmldict.key</strong></p>
  
  <pre><code>name
  age
  gender
  name
  age
  gender
  name
  age
  gender
  </code></pre>