<?php
$xmlData = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<configdata>
<records>
<somekey>
<record>
<firstname>Jonathan</firstname>
<lastname>Kushner</lastname>
</record>
<record>
<firstname>Dustin</firstname>
<lastname>Kushner</lastname>
</record>
<record>
<firstname>Cameron</firstname>
<lastname>Kushner</lastname>
</record>
</somekey>
</records>
</configdata>
XML;
// Create the document object
$doc = new DOMDocument;
// This is required in order to ignore the pretty-print whitspace
$doc->preserveWhiteSpace = false;
// load the data into the object
$doc->loadXML($xmlData);
$xpath = new DOMXpath($doc);
$result = array();
// Get the text nodes and loop them
foreach ($xpath->query('//text()') as $record) {
$result[] = $record->data;
}
print_r($result);