title: Get attribute values SimpleXML Xpath PHP
body: <pre><code>&lt;RESULTS&gt;
      &lt;ROW&gt;
          &lt;COLUMN NAME="ID"&gt;&lt;![CDATA[001]]&gt;&lt;/COLUMN&gt;
          &lt;COLUMN NAME="NAME"&gt;&lt;![CDATA[ORG001]]&gt;&lt;/COLUMN&gt;
          &lt;COLUMN NAME="CODE"&gt;&lt;![CDATA[1234]]&gt;&lt;/COLUMN&gt;
      &lt;/ROW&gt;
  &lt;/RESULTS&gt;
  </code></pre>
  
  <p>Using simplexml / xpath i would like to return the attribute text for 'NAME' and 'CODE' for ID 001, there is many rows so the result would be different based on id number</p>
  
  <p><strong>Edit:</strong> 
  accessing the CDATA isn't the problem here, it is returning the values of name and code where id = 001 etc</p>
  
  <p>heres what i tried to get the name</p>
  
  <p><code>echo (string)$xml-&gt;xpath('/RESULT/ROW/COLUMN[@ID] = ["001"]/COLUMN[@Name="NAME"]');</code></p>
  
  <p>Thanks</p>