Provided by: libcatmandu-xsd-perl_0.04-1_all bug

NAME

       Catmandu::Exporter::XSD - Export and validate XML documents

SYNOPSIS

           # Convert one shiporder YAML to XML
           catmandu convert YAML to XSD --root '{}shiporder'
                                        --schemas demo/order/*.xsd < shiporder.YAML

           # Same as above but store multiple shiporders in the YAML into a separate file
           catmandu convert YAML to XSD --root '{}shiporder'
                                        --schemas demo/order/*.xsd
                                        --split 1
                                        < shiporder.YAML

           # Same as above but use template toolkit to pack the XML into an container
           # (The xml record is stored in the 'xml' key which can be retrieved in the
           # template by [% xml %])
           catmandu convert YAML to XSD --root '{}shiporder'
                                        --schemas demo/order/*.xsd
                                        --template_before t/xml_header.tt
                                        --template t/xml_record.tt
                                        --template t/xml_footer.tt
                                        < shiporder.YAML

           use Catmandu;

           # Print to STDOUT
           my $exporter = Catmandu->exporter('XSD',
                               root => ...
                               schemas => ...
           );

           $exporter->add_many($arrayref);
           $exporter->add_many($iterator);
           $exporter->add_many(sub { });
           $exporter->add($hashref);

           $exporter->commit;

DESCRIPTION

       This is a Catmandu::Exporter for converting Perl into valided XML documents using an XSD
       schema file.

CONFIGURATION

       file
           Write output to a local file given by its path. Alternatively a scalar reference can
           be passed to write to a string.

       fh  Write output to an IO::Handle. If not specified, Catmandu::Util::io is used to create
           the output stream from the "file" argument or by using STDOUT.

       split
           Optional. Don't write to the file (or STDOUT) and split the output documents into one
           or more files. E.g.

               catmandu ... to XSD --root ... --schemas ... --split 1  < data

       split_pattern
           Optional. Use a FORMAT as template for naming output files. Uses the '_id' field in
           the data or an incremental counter as input. E.g.

               # Creates 000001.xml , 000002.xml, etc
               catmandu ... to XSD --root ... --schemas ... --split 1 --split_pattern '%-6.6d.xml' < data

       split_directory
           Optional. Specify the directory in which the split files need to be written.

       template
           Optional. A template toolkit template to be used for creating each XML output record.
           Gets as input the input data plus the XML serialized form in the 'xml' field.

       template_before
           Optional. The template toolkit template to be used as XML header.

       template_after
           Optional. The template toolkit template to be used as XML footer.

       fix An ARRAY of one or more fixes or file scripts to be applied to imported items.

       root
           Required. The name (and namespace) of the root element of the XML document. E.g.:

               {}shiporder
               {http://www.loc.gov/mods/v3}mods
               {urn:isbn:1-931666-22-9}ead

       schemas
           Required. An array or comma separated list of XSD schema locations.

       prefixes
           Optional. An array or comma delimited string of namespace prefixes to be used hand
           handling XML files. E.g.

               # On the command line:
               catmandu ... --prefixes ead:urn:isbn:1-931666-22-9,...

               # In Perl
               prefixes => [
                   ead => 'urn:isbn:1-931666-22-9' ,
                   ... => ...
               ]

       mixed
           Optional. The handling of mixed element content. One of ATTRIBUTES (default), TEXTUAL,
           STRUCTURAL, XML_NODE, XML_STRING, CODE reference. See also Catmandu::XSD and
           XML::Compile::Translate::Reader

METHODS

       Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited.

SEE ALSO

       Catmandu::Exporter, Catmandu::XSD , Template