title: SimpleXML get node value
body: <p>Say I have this following XML structure:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;main&gt;
      &lt;parent&gt;
          &lt;child1&gt;some value&lt;/child1&gt;
          &lt;child2&gt;another value&lt;/child2&gt;
      &lt;/parent&gt;
  &lt;/main&gt;
  </code></pre>
  
  <p>I made a variable of the XML and now I want to get the values of child1, so I use SimpleXML:</p>
  
  <pre><code>$xml = new SimpleXMLElement($xml);
  $this-&gt;xmlcode = (string) $xml-&gt;main-&gt;parent-&gt;child1;
  </code></pre>
  
  <p>But I get this message: Notice: Trying to get property of non-object in /x.php on line x</p>
  
  <p>I also tried it with $xml->parent->child1, but no success.</p>
  
  <p>Anyone?? </p>