I am using simplexml to parse xml and I can get single node but not all nodes i want
example
$xmlObject = simplexml_load_file($xml_file); // load the xml file
$cols = $xmlObject->RESULTSET->ROW->COL;
foreach ( $cols as $COL) {
echo $COL->DATA;
}
only gives me the first col of the first row, i tried
$xmlObject = simplexml_load_file($xml_file); // load the xml file
$cols = $xmlObject->xpath('*//COL');
foreach ( $cols as $COL) {
echo $COL->DATA;
}
and got nothing back
any idea what I might be doing wrong ?
<?xml version="1.0" encoding="UTF-8"?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<RESULTSET FOUND="445">
<ROW MODID="45" RECORDID="1">
<COL>
<DATA>Integrating Ethanol</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>train track and gas pump</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>1.jpg</DATA>
</COL>
<COL>
<DATA/>
</COL>
</ROW>
<ROW MODID="29" RECORDID="3">
<COL>
<DATA>Keeping in Balance</DATA>
</COL>
<COL>
<DATA>21</DATA>
</COL>
<COL>
<DATA>book cover of Sweet Invisible Body</DATA>
</COL>
<COL>
<DATA/>
</COL>
</ROW>
</RESULTSET>
</FMPXMLRESULT>