DOKK / manpages / debian 12 / libcatmandu-mab2-perl / MAB2::Writer::XML.3pm.en
MAB2::Writer::XML(3pm) User Contributed Perl Documentation MAB2::Writer::XML(3pm)

MAB2::Writer::XML - MAB2 XML format serializer

MAB2::Writer::XML is a MAB2 XML serializer.

    use MAB2::Writer::XML;
    my @mab_records = (
        [
          ['001', ' ', '_', '2415107-5'],
          ['331', ' ', '_', 'Code4Lib journal'],
          ['655', 'e', 'u', 'http://journal.code4lib.org/', 'z', 'kostenfrei'],
          ...
        ],
        {
          record => [
              ['001', ' ', '_', '2415107-5'],
              ['331', ' ', '_', 'Code4Lib journal'],
              ['655', 'e', 'u', 'http://journal.code4lib.org/', 'z', 'kostenfrei'],
              ...
          ]
        }
    );
    my $writer = MAB2::Writer::XML->new( fh => $fh, xml_declaration => 1, collection => 1 );
    
    $writer->start();
    foreach my $record (@mab_records) {
        $writer->write($record);
    }
    $writer->end();

"xml_declaration"
Write XML declaration. Set to 0 or 1. Default: 0. Optional.
"collection"
Wrap records in collection element (<datei>). Set to 0 or 1. Default: 0. Optional.

See also MAB2::Writer::Handle.

start()

Writes XML declaration and/or start element for a collection.

_write_record()

end()

Writes end element for the collection.

MAB2::Writer::Handle, Catmandu::Exporter.

Johann Rolschewski <jorol@cpan.org>

This software is copyright (c) 2013 by Johann Rolschewski.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2022-12-04 perl v5.36.0