private function buildCountries($xml) { $countries = new Countries(); $countryArray = array(); foreach ($xml->Country as $country) { $tmpCountry = new Country(); $tmpCountry->setCode((string) $country->Code); $tmpCountry->setGeoCoding((string) $country->Geocoding); $tmpCountry->setName((string) $country->Name); array_push($countryArray, $tmpCountry); } $countries->setCountry($countryArray); return $countries; }