Hi, Thanks for the solutions of the recent problems.
I would like to traverse a dir on the HDD at a part of the XML generation. So I generated about 75% of an xml file with xml::writer, and it comes a Projectstructure tag. Between these tag I simply list a dir into empty tags <Object attr=...../>. If recursion is ready, the closing Projectstructure tag closes it. And non recursive XML generation continues. $output = IO::File->new(">default.xml"); $writer = XML::Writer->new(OUTPUT => $output, DATA_MODE => 1, DATA_INDENT => " ", ENCODING => "utf-8", NEWLINES => 0 ); Traverse($dir, $writer); sub Traverse { opendir(DIR, $dir) or die "Cannot open directory $dir: $!\n"; my @files = readdir(DIR); closedir(DIR); foreach my $file (@files) { # generate XML here print $file; if(-d $file and ($file !~ /^\.\.?$/) ) { # make dir branch Traverse($file); } $writer->emptyTag("Object", "Name" => $file"); # make file branch } } ... $writer->startTag("ProjectStructure"); Traverse("C:\\ph"); $writer->endTag("ProjectStructure"); But it gives a hideous error: Attempt to insert empty tag after close of document element at t2tot3Project line 72. How can it be? I call the subrutine in the middle of a tag. How can be the document closed? Tamas