Parsing XML in PHP returns SimpleXMLElement Object. What next?

I am trying to get data from library of congress book search to get information like, title, creator, publisher etc. Below is the php and the response I get. I am stuck at [recordData] => SimpleXMLElement Object. How do I look through this to get the information i need? print_r ($yr->records->record->recordData) gives me the response “SimpleXMLElement Object()” and nothing else.

Here is the xml file



$namespaces = $entry->getNameSpaces(true);
$yr = $entry->children($namespaces['zs']);
print_r ($yr);

I get this response back. How do I get into the recordData part?

SimpleXMLElement Object
    [version] => 1.1
    [numberOfRecords] => 2238
    [records] => SimpleXMLElement Object
            [record] => SimpleXMLElement Object
                    [recordSchema] => info:srw/schema/1/dc-v1.1
                    [recordPacking] => xml
                    [recordData] => SimpleXMLElement Object

                    [recordPosition] => 1



Step one is to read through some basic examples of using SimpleXML –