#! /usr/bin/env perl use strict; use warnings; use XML::LibXML; # input xml document my $parser = XML::LibXML->new; my $doc = $parser->parse_file($ARGV[0]); # build root - strip directories up to here to show offsets my $root = "ex1/"; # html output document $parser = XML::LibXML->new; my $html = $parser->parse_html_string(" Triggered makefiles

Triggered makefiles

makelevel pwd start time end time
"); $html->setEncoding("UTF-8"); my $table = ($html->findnodes("/html/body/table"))[0]; # for each makelog section in the input xml add a table row to the output # containing makelevel, pwd, stime and etime foreach my $ml ($doc->findnodes("//makelog")) { my $tr = $table->addNewChild('','tr'); $tr->appendTextChild('td', $ml->findvalue("makeinfo/makelevel")); (my $dir = $ml->findvalue("makeinfo/pwd")) =~ s/^.*$root//; $tr->appendTextChild('td', $dir); $tr->appendTextChild('td', substr($ml->findvalue("makeinfo/stime"),11,11)); $tr->appendTextChild('td', substr($ml->findvalue("makeinfo/etime"),11,11)); } # write html to a file $html->toFile('makefiles.html', 1);