[Raku LibXML Project] / [LibXML-Writer Module] / Writer :: File
Stream to an external file
use LibXML::Writer::File;
use File::Temp;
my (Str:D $file, IO::Handle $ioh) = tempfile();
my LibXML::Writer::File $writer .= new: :$file;
$writer.startDocument();
$writer.startElement('Baz');
$writer.endElement;
$writer.endDocument;
$writer.close;
say $ioh.lines.join; # <?xml version="1.0" encoding="UTF-8"?><Baz/>;
This output class enables efficient low-memory streaming of an XML document directly to a file.