- simplexml_load_string: documentation ( source)
<?php
$filename = '
<NO_MARK>9.</NO_MARK>
<TI_MARK>Budjetti</TI_MARK>
<MLI_OCCUR>
<NO_MARK>10.</NO_MARK>
<TI_MARK>Hankintailmoituksen ennakoitu julkaisuajankohta:</TI_MARK>
<TXT_MARK>
<P>Lokakuu 2013.</P>
</TXT_MARK>
</MLI_OCCUR>
<MLI_OCCUR NO_SEQ="011">
<NO_MARK>11.</NO_MARK>
</MLI_OCCUR>';
$xml_file = simplexml_load_string($filename);
parseXML($xml_file->children());
function parseXML($xml_children)
{
foreach ($xml_children as $child){
echo $child->getName().':'. $child."<br>";
if ($child->count() > 0)
{
parseXML($child->children());
}
}
}