vasuperl has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Can any one help me out how to create xml file using perl script? I have to create an xml file in which it contains the name of the test cases, result and logs of those test cases. In logs hyperlink should be created so that we can go to the logs of respective test case. I am new to perl. Can any one help me, how to figure out this? Thanks in Advance.

Replies are listed 'Best First'.
Re: How to create xml file using perl
by pme (Monsignor) on Dec 31, 2014 at 12:27 UTC
Re: How to create xml file using perl
by locked_user sundialsvc4 (Abbot) on Dec 31, 2014 at 17:05 UTC

    There are this and many other XML-handling libraries ... XML::LibXML, XML::Twig .. many more ... but the basic notion is the same:   use an XML library to handle XML.   Build a data-structure in memory, using hashrefs and so-forth, then use the library to create a proper XML structure which contains it.   (Treat that string as a “black box.”)   Validate this XML against the target system ... or, if they supply a schema, use an XML-validation tool to validate your output against that schema.

    What you generally do not want to do is to try to “brute-force generate” an XML-looking output yourself.   This certainly can be done, e.g. using Template::Toolkit, but it’s a lot more work to yield a more-uncertain output string.