HI,
I want to create a .xml file output after some post proccessing in my script and i am using XML::LibXML to do that , but it prints data as a string to the console. How do i get the output in an XML file?. I referred to XML::LibXML module documentation on CPAN and i din't find anything about this. Can anyone suggest how i can generate a .xml file. Below is what i am doing.
my $doc1 = XML::LibXML::Document->new('1.0', 'utf-8');
my $root = $doc1->createElement("TestSummary");
$root->setAttribute('Test'=> 'Sprint12');
my %tags = (
resultcount => $resultcount,
testcasecount => $testcasecount,
);
for my $name (keys %tags) {
my $tag = $doc1->createElement($name);
my $value = $tags{$name};
$tag->appendTextNode($value);
$root->appendChild($tag);
}
$doc1->setDocumentElement($root);
print $doc1->toString();
Output is generated in the console as below
<?xml version="1.0" encoding="utf-8"?>
<TestSummary some-attr="some-value"><resultcount>7</resultcount><testc
+asecount>9</testcasecount></TestSummary>
The last statement is responsible to print it as a string but i want to generate an xml file from my output