filterXPath('//laender/land') ->each(function (Crawler $node) use (&$countries) { $country = new Country(); $country->id = (int) $node->attr('id'); $country->name = $node->attr('bezeichnung'); $country->token = $node->attr('kuerzel'); $country->nationality = $node->attr('nationalitaet'); $countries[$country->token] = $country; }) ; return new BaseData($countries); } }