Get node value from document

Posted by J Noel on Stack Overflow See other posts from Stack Overflow or by J Noel
Published on 2012-09-13T21:25:02Z Indexed on 2012/09/13 21:38 UTC
Read the original article Hit count: 210

Filed under:
|

I have XML in PHP, I am trying to get the value of the status node:

<?xml version="1.0" encoding="utf-8" ?>
<response>
  <result>
    <form name="MREP">
      <update>
        <criteria>
          <field name="Serial_Number" compOperator="Equals" value="A-000-1012"></field>
          <reloperator>AND</reloperator>
          <field name="MREP_Type" compOperator="Equals" value="0"></field>
        </criteria>
        <newvalues>
          <field name="Is_being_Used">
            <value><![CDATA[TRUE]]></value>
          </field>
        </newvalues>
        <status>Success</status>
      </update>
    </form>
  </result>
</response>

I tried

$xml = simplexml_load_string($mrepValide); 
echo $xml->status;

(where $mrepValide is a string of XML shown above)

But I think it didnt work since status is not the parent node. Any help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about php

Related posts about Xml