title: Read XML node attribute in PowerShell
body: <p>I have a class with few properties. Constructor of that class getting one string attribute where is xml string read from database clob column.</p>
  
  <pre><code>#Powershell code
  Class test
  {
      [string]$prop1
      [int]$prop2
      test([string]$input)
      {
          $xml = [xml]$input
          $this.prop1 = $xml|Select-XML -XPath '/Properties/Property[@name="Validation"]'
          $this.prop2 = $xml|Select-XML -XPath '/Properties/Property[@name="Port"]'
      }
  }
  </code></pre>
  
  <p>This how xml string looks like</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;properties&gt;
    &lt;property name="Validation" value="yes"/&gt;
    &lt;property name="Port" value="636"/&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>I'm trying to retrieve node attribute from XML file.
  The problem is that constructor doesn't assign values to the properties.
  I'm not getting any data in the line below.</p>
  
  <pre><code>$xml|Select-XML -XPath '/Properties/Property[@name="Port"]'
  </code></pre>