NAME
TypeLibrary::FromXSD - create a Type::Tiny library of simpleTypes in
.xsd files.
VERSION
version 0.05
SYNOPSIS
use TypeLibrary::FromXSD;
my $generator = TypeLibrary::FromXSD->new(
xsd => '/path/to/file.xsd',
output => '/path/to/Library.pm',
);
$generator->run;
DESCRIPTION
This module helps to create a library for types (using Type::Tiny)
based on a XML schema. It searches for simpleTypes in the .xsd file and
creates a type for it.
ATTRIBUTES
* types
* xsd
* output
* namespace
* version_add
METHODS
run
SUPPORTED TYPES
Date And DateTime
create those types:
declare ISODate =>
as Str,
where {
($_ =~ m{\A-?[0-9]{4,}-[0-9]{2}-[0-9]{2}(?:Z|[-+]?[0-2][0-9]:[0-5][0-9])?\z}) &&
(validate_date( $_ )) # if an extra validation is passed
};
Strings
=>
declare BEIIdentifier =>
as Str,
where{
($_ =~ m![A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}!)
};
Enumerations
=>
declare AddressType2Code => as enum ["ADDR","PBOX","HOME","BIZZ","MLTO","DLVY"];
Numbers
=>
declare CurrencyAndAmount_SimpleType =>
as Num,
where {
($_ <= 0) &&
(length( (split /\./, $_)[1] ) == 5) &&
(tr/0123456789// == 18)
};
AUTHOR
Renee Baecker
COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)