I have a xml file
<?xml version="1.0" encoding="UTF-8"?> <xml> <settings> <title>Calendar for September</title> <subTitle>Calendar for September Calendar for September</subTitle> </settings> <events date="06-09-2010"> <event id="2"> <title>This is My Second Event</title> <description>This is My Second Event </description> </event> <event id="3"><title>This is My Third Event </title><description>This is My Third Event This is My Third Event This is My Third Event </description></event></events> </xml> I am parsing the xml file using
$xml_str = file_get_contents('xmlfile'); $xml = simplexml_load_string($xml_str); if(!empty($xml)) { $nodes = $xml->xpath('//xml/events/event[@id="'.$id.'"]'); } It will give only the title and description of event tag with specified id.How i can get the date