LibXML-Writer-raku

[Raku LibXML Project] / [LibXML-Writer Module] / Writer :: File

class LibXML::Writer::File

Stream to an external file

Synopsis

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/>;

Description

This output class enables efficient low-memory streaming of an XML document directly to a file.