If you have PHP5 on your server, you can try:
$string = "<?xml version='1.0'?> <doc> <title>XML Document</title> <date timezone=\"GMT+1\">2008-01-01 13:42:53</date> <message>Daylight savings starting soon!</message> </doc>"; $xml = simplexml_load_string($string); // Show current timezone echo $xml->date['timezone'].'<br>'; // Set a new timezone $xml->date['timezone'] = 'GMT+10'; echo $xml->date['timezone'];
Note Look at the spaces - XML ββmust be well-formed for SimpleXML for proper parsing.
Alternatives include simplexml_load_file() and simplexml_import_dom() .
mattoc 05 Oct '08 at 6:14 2008-10-05 06:14
source share