I have challenges reading the value of "CMBDESTINOSV" and each of "chk_xxxxx" in the "coberData" using SimpleXMLElement in the below code snippet. The code snippet is from an xml response.
I have tried
$xml->coberData->chk_C0000;
$xml->riskData->CMBDESTINOSV->option->cd[1];
but nothing was returned. Please help.
<root>
<riskData label="Risk details">
<CMBDESTINOSV afectaAlPrecio="true" dataName="CMBDESTINOSV" id="CMBDESTINOSV" name="CMBDESTINOSV" type="5" style="width:120" label="Destination" visible="true" maxlength="2" readOnly="false" obligatorio="true" size="3" newLine="false" etiquetaEncima="false" value="-1">-1
<option>
<cd>-1</cd>
<ds/>
</option>
<option>
<cd>7</cd>
<ds>05 - Wordlwide Excluding USA & Canada - Wordlwide Excluding USA & Canada</ds>
</option>
<option>
<cd>10</cd>
<ds>08 - WORLDWIDE - ALL COUNTRIES</ds>
</option>
</CMBDESTINOSV>
</riskData>
<coberData label="Coverage details">
<chk_C0000 afectaAlPrecio="true" dataName="chk_C0000" id="chk_C0000" name="chk_C0000" type="6" label="BAGAGES" visible="true" onClick="" maxlength="180" readOnly="false" obligatorio="false" size="180" newLine="false" etiquetaEncima="false" value="0"/>
<chk_I0000 afectaAlPrecio="true" dataName="chk_I0000" id="chk_I0000" name="chk_I0000" type="6" label="MEDICAL COMPLEMENTARY SERVICES" visible="true" onClick="" maxlength="180" readOnly="true" obligatorio="true" size="180" newLine="false" etiquetaEncima="false" value="1"/>
<chk_F0000 afectaAlPrecio="true" dataName="chk_F0000" id="chk_F0000" name="chk_F0000" type="6" label="PERSONAL ACCIDENTS" visible="true" onClick="" maxlength="180" readOnly="true" obligatorio="true" size="180" newLine="false" etiquetaEncima="false" value="1"/>
<chk_D0002 afectaAlPrecio="true" dataName="chk_D0002" id="chk_D0002" name="chk_D0002" type="6" label="TRAVEL DELAY" visible="true" onClick="" maxlength="180" readOnly="true" obligatorio="true" size="180" newLine="false" etiquetaEncima="false" value="1"/>
<chk_G0000 afectaAlPrecio="true" dataName="chk_G0000" id="chk_G0000" name="chk_G0000" type="6" label="PERSONAL LIABILITY" visible="true" onClick="" maxlength="180" readOnly="true" obligatorio="true" size="180" newLine="false" etiquetaEncima="false" value="1"/>
<chk_B0003 afectaAlPrecio="true" dataName="chk_B0003" id="chk_B0003" name="chk_B0003" type="6" label="PERSONAL ASSISTANCE" visible="true" onClick="" maxlength="180" readOnly="true" obligatorio="true" size="180" newLine="false" etiquetaEncima="false" value="1"/>
<chk_CAN afectaAlPrecio="true" dataName="chk_CAN" id="chk_CAN" name="chk_CAN" type="6" label="CANCELLATION" visible="true" onClick="" maxlength="180" readOnly="false" obligatorio="false" size="180" newLine="false" etiquetaEncima="false" value="0"/>
<chk_U0030 afectaAlPrecio="true" dataName="chk_U0030" id="chk_U0030" name="chk_U0030" type="6" label="ACCIDENTAL DAMAGE" visible="true" onClick="" maxlength="180" readOnly="true" obligatorio="true" size="180" newLine="false" etiquetaEncima="false" value="1"/>
</coberData>
</root>