you can use the '{}' to access you property, and then you can do as you wish. Save it or display the content.
$varName = $xml->{'key'};
From your example her's the code
$filePath = __DIR__ . 'Your path ';
$fileName = 'YourFilename.xml';
if (file_exists($filePath . $fileName)) {
$xml = simplexml_load_file($filePath . $fileName);
$mainNode = $xml->{'code'};
$cityArray = array();
foreach ($mainNode as $key => $data) {
$cityArray[..] = $mainNode[$key]['cityCode'];
....
}
}