| Catmandu::Importer::XSD(3pm) | User Contributed Perl Documentation | Catmandu::Importer::XSD(3pm) |
Catmandu::Importer::XSD - Import and validate serialized XML documents
# 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];
# ...
});
This is a Catmandu::Importer for parsing and validating XML data using one or more XSD schema files.
catmandu ... --files 'data/input/*.xml'
catmandu convert XSD --root {}shiporder --schemas "t/demo/ead/*xsd" --example 1 to YAML
{}shiporder
{http://www.loc.gov/mods/v3}mods
{urn:isbn:1-931666-22-9}ead
# On the command line:
catmandu ... --prefixes ead:urn:isbn:1-931666-22-9,...
# In Perl
prefixes => [
ead => 'urn:isbn:1-931666-22-9' ,
... => ...
]
Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited.
Catmandu::Importer, Catmandu::XSD
| 2017-10-02 | perl v5.26.0 |