I also answered this on Stack Overflow.
I started with the CRUD datagrid tutorial version so my answer might be a bit different. I started from the CRUD example, converting from the mySQL solution to instead use XML.
http://www.jeasyui.com/tutorial/app/crud2.php$(function(){
$('#dg').edatagrid({
url: 'get_data.php' /* pulls in the data from a xml file */
});
});
My example actually had the read (url), create (saveURL), update (updateURL), and delete (destroyUrl) but for this answer I just put the url to read the data in.
For my get_data.php I converted my XML file into JSON. I also removed a root I had in that XML file.
if(!$xml = simplexml_load_file("mydata.xml", null, LIBXML_NOCDATA)) {
echo "unable to load file";
}
{
$xmlarray = array(); // create a new array
foreach ($xml as $element) { // loop through the xml file elements
array_push($xmlarray, $element); // push the elements on the xml array
}
}
echo json_encode($xmlarray); // encode that json without the root xml element
I am still sticking with simplexml, there are easier ways to do this when you get into removing and updating.