I am looking to extract data from an XML feed containing information on books.

The feed is set up like this:

<product>
<title></title>
<price></price>
<fields>
<author></author>
</fields>
</product>
Now, having set the parent node as 'product', I can access the title and price data without any problem.

Here's the code I've got at the moment, but how do I amend it to access the 'author' information from the 'fields' node?

PHP Code:

case 'product';

//initialise xml parser
$dom = new DOMDocument();
$domNode $xmlReader->expand();
$element $dom->appendChild($domNode);
$domString utf8_encode($dom->saveXML($element));
$product = new SimpleXMLElement($domString);

//import data
$name $product->name;
$product_url $product->url;
$price $product->price;
$author $product->author;
$rank $product->rank;

//insert query into database


        
$query mysql_query("REPLACE INTO db_namet
        (rank, title, author, price, url)
        
        VALUES ('
$rank', '$name', '$author', '$price', '$product_url')");
        
        echo 
$product_name "has been inserted </br>"
Thanks very much in advance for your help