Use XML-writer
#! C:/perl/bin/
Use XML: writer;
Use IO;
# Open file stream. Param is file name.
My $ output = new IO: file ("> output. xml ");
# New A output stream.
My $ writer = New XML: writer (output => $ output)
Or die "create fail ";
Print "file create success! ";
# Seting XML encoding. version is 1.0.
$ Writer-> xmldecl ("gb2312 ");
# Seting enter
$ Writer-> setdataindent ("/N ");
# Seting first class start tag
$ Writer-> starttag ("root ");
# Fill in/n
$ Writer-> characters ("/N ");
# Seting seconly class start tag
$ Writer-> starttag ("child ");
# Seting third class start tag
$ Writer-> dataelement ("count", "123 ");
$ Writer-> dataelement ("name", "Sss ");
# Seting seconly class end tag
$ Writer-> endtag ("child ");
$ Writer-> characters ("/N ");
$ Writer-> starttag ("child ");
$ Writer-> dataelement ("count", "123 ");
$ Writer-> dataelement ("name", "Sss ");
$ Writer-> endtag ("child ");
$ Writer-> characters ("/N ");
# Seting first class end tag
$ Writer-> endtag ("root ");
# Close writer stream
$ Writer-> end ();
# Close output stream
$ Output-> close ();