{ my $nest = XML::Writer::Nest->(tag => 'level1'); { $nest->nest(newlevel => [attr1 => 1, attr2 => 2]); ... } }