title: PHP/XML - checking if a node is set
body: <p>I have an XML document structured like this:</p>
  
  <pre><code>&lt;produkter&gt;
      &lt;produkt&gt;
          &lt;forhandler&gt;&lt;/forhandler&gt;
          &lt;produktnavn&gt;&lt;/produktnavn&gt;
          and so on...
      &lt;/produkt&gt;
  &lt;/produkter&gt;
  </code></pre>
  
  <p>I am pulling out data like this:</p>
  
  <pre><code>$produktnavn = utf8_decode($xmlObject-&gt;item($i)-&gt;getElementsByTagName('produktnavn')-&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue);
  </code></pre>
  
  <p>Now I am looking to do a check to see if the node is present in the XML document at all.</p>
  
  <p>For example... I only want to make the operation above if there actually IS a node called "produktnavn".</p>
  
  <p>I am trying with:</p>
  
  <pre><code>if (isset($xmlObject-&gt;item($i)-&gt;forhandler)) {
  </code></pre>
  
  <p>But this doesn't seem to work.</p>
  
  <p>What an I doing wrong?</p>