title: Determine XML Node Exists
body: <p>This is probably simple, but I'm trying to determine if a node exists in an XML document. I thought I found an answer in this post,
  <a href="https://stackoverflow.com/questions/13031110/how-to-check-whether-a-node-exists-or-not-using-powershell-without-getting-excep">How to check whether a node exists or not using powershell without getting exception?</a>, but I didn't get it to work. This is my latest attempt.</p>
  
  <pre><code>foreach ($vendor in $xml.Vendors.Vendor| Where-Object  {$_.Type -match "Send"}) {
      $NodeExists = $vendor.SelectSingleNode($vendor.EncKey)
      if ($NodeExists -ne $null) {
          # Do something
      }
      else {
         # something else
      }
     }
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>EDIT: Here is XML from my test file. I need to find out of EncKey exists or note for each vendor.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;!-- Vendors we will send and retreive files from Get-Send means we will get a file and send them a file Send means we will only send them a file--&gt;
      &lt;Vendors&gt;
          &lt;Vendor Type="Get-Send"&gt;
              &lt;Name&gt;Vendor1&lt;/Name&gt;            
              &lt;RemotePath&gt;/Remote/Path1/&lt;/RemotePath&gt;
              &lt;EncKey&gt;pgpenc.key&lt;/EncKey&gt;
          &lt;/Vendor&gt;
          &lt;Vendor Type="Send"&gt;
              &lt;Name&gt;Vendor2&lt;/Name&gt;            
              &lt;RemotePath&gt;/Remote/Path2/&lt;/RemotePath&gt; 
              &lt;!-- This one has no EncKey --&gt;         
          &lt;/Vendor&gt;
      &lt;/Vendors&gt;
  </code></pre>