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

NAME

       Catmandu::Importer::XSD - Import and validate serialized XML documents

SYNOPSIS

           # Compile an XSD schema file and parse one shiporder.xml file
           catmandu convert XSD --root '{}shiporder'
                                --schemas demo/order/*.xsd
                                to YAML < shiporder.xml

           # Same as above but parse more than one file into an array of records
           catmandu convert XSD --root '{}shiporder'
                                --schemas demo/order/*.xsd
                                --files 'data/*.xml'
                                to YAML

           # Same as above but all array of records are in a XML container file
           catmandu convert XSD --root '{}shiporder'
                                --schemas demo/order/*.xsd
                                --xpath '/Container/List//Record/Payload/*'
                                to YAML < data/container.xml

           # In Perl
           use Catmandu;

           my $importer = Catmandu->importer('XSD',
                       file => 'ex/data.xml'
                       root => ...,
                       schemas => [ ...]
           );

           my $n = $importer->each(sub {
               my $hashref = $_[0];
               # ...
           });

DESCRIPTION

       This is a Catmandu::Importer for parsing and validating XML data using one or more XSD
       schema files.

CONFIGURATION

       file
           Read input from a local file given by its path. Alternatively a scalar reference can
           be passed to read from a string.

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

       files
           Optional. Don't read the content from the standard input but use the 'files' parameter
           as a glob for one or more filenames. E.g.

               catmandu ... --files 'data/input/*.xml'

       examples
           Optional. Don't do anything only show an example output how a document should be
           structured in the given XSD scheme. E.g.

               catmandu convert XSD --root {}shiporder --schemas "t/demo/ead/*xsd" --example 1 to YAML

       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.

       xpath
           Optional. An XPath expression, the XML container in which the PNX record can be found.
           Default : /oai:OAI-PMH/oai:ListRecords//oai:record/oai:metadata/*

       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

       any_element
           Optional. The handling of "<any"> content in schemas. One of TAKE_ALL (default:
           process as XML::LibXML::Node) , SKIP_ALL (ignore these) , XML_STRING (process as
           string) , CODE (provide a reference to parse the data). See
           XML::Compile::Translate::Reader

METHODS

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

SEE ALSO

       Catmandu::Importer, Catmandu::XSD