Here is a good overview of working with XML in PHP.
Instead of using XPath, I would recommend using SimpleXML and DOM to parse it. For example...
<?xml version="1.0" encoding="UTF-8"?>
<books>
<book>
<title>Great American Novel</title>
<characters>
<character>
<name>Cliff</name>
<desc>really great guy</desc>
</character>
</characters>
</book>
</books>
You could parse by doing this (assuming XML is in $xmlstr
)...
<?php
$xml = new SimpleXMLElement($xmlstr);
echo $xml->book[0]->title; // "Great American Novel"
?>