package House { use XML::Rabbit::Root; has_xpath_object_list depts => '/root/departments/department' => 'House::Depts'; finalize_class(); } package House::Depts { use XML::Rabbit; has_xpath_object_list articles => './articles/article[key]|./articles/article/extra' => 'House::Article'; has_xpath_value name => './name'; finalize_class(); } package House::Article { use XML::Rabbit; has_xpath_value key => './key|./extrakey'; has_xpath_object prod => './production' => 'Article::Production'; finalize_class(); } package Article::Production { use XML::Rabbit; has_xpath_value country => './country'; has_xpath_value year => './year'; finalize_class(); } 1;