- simplexml_load_string: documentation ( source)
<?php
$xml=simplexml_load_string(<<<XML
<Records>
<record>
<Constituency>Smith</Constituency>
<State>16753</State>
<ElectionDate>UK</ElectionDate>
<WikipediaLink>Qtr 3</WikipediaLink>
<Election.inLink>Qtr 3</Election.inLink>
</record>
<record>
<Constituency>Johnson</Constituency>
<State>14808</State>
<ElectionDate>USA</ElectionDate>
<WikipediaLink>Qtr 4</WikipediaLink>
<Election.inLink>Qtr 4</Election.inLink>
</record>
</Records>
XML
);
$record = $xml;
foreach ($record as $Entry) {
echo $Entry->Constituency.' , '.$Entry->State.' <br />';
}