title: Looping through XML using PowerShell
body: <p>I am trying to loop through a XML using PowerShell, but unable to get the <code>InnerXML</code> details.</p>
  
  <p><strong>XML:</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;script&gt;
      &lt;data&gt;
          &lt;address&gt;
              &lt;street&gt;WhiteField&lt;/street&gt;
              &lt;zip&gt;560100&lt;/zip&gt;
              &lt;city&gt;Bangalore&lt;/city&gt;
              &lt;country&gt;India&lt;/country&gt;
              &lt;postofficebox&gt;BangaloreEast&lt;/postofficebox&gt;
          &lt;/address&gt;
      &lt;/data&gt;
      &lt;data&gt;
          &lt;address&gt;
              &lt;street&gt;Gurgaon&lt;/street&gt;
              &lt;zip&gt;601000&lt;/zip&gt;
              &lt;city&gt;New Delhi&lt;/city&gt;
              &lt;country&gt;India&lt;/country&gt;
              &lt;postofficebox&gt;New Delhi West&lt;/postofficebox&gt;
          &lt;/address&gt;
      &lt;/data&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Script:</strong></p>
  
  <pre class="lang-bsh prettyprint-override"><code>[string]$FilePath = 'C:\Users\Sujeet\Desktop\UserData.xml'
  
  try {
      [xml]$XMLInput = Get-Content -Path $FilePath
  } catch {
      Write-Host "Failed to read or parse the XML File."
      exit
  }
  
  if ((Select-Xml -Xml $XMLInput -XPath "//address" | measure).Count -gt 0) {
      Select-Xml -Xml $XMLInput -XPath "//address" | foreach {
          $_.Node.InnerXML
      }
  }
  </code></pre>
  
  <p>How do I get the values for <code>&lt;street&gt;</code>, <code>&lt;city&gt;</code>, <code>&lt;country&gt;</code>?</p>
  
  <p>Also I want to fetch the details only if the city is "Bangalore".</p>