XML::Compile::Schema::BuiltInTypes - Define handling of built-in data-types
XML::Compile::Schema::BuiltInTypes is a Exporter
# Not for end-users use XML::Compile::Schema::BuiltInTypes qw/%builtin_types/;
Different schema specifications specify different available types, but there is a lot over overlap. The XML::Compile::Schema::Specs module defines the availability, but here the types are implemented.
This implementation certainly does not try to be minimal in size: using the restriction rules and inheritance structure defined in the schema specification would be too slow.
The functions named in this chapter are all used at compile-time by the translator. At that moment, they will be placed in the kind-of opcode tree which will process the data at run-time. You cannot call these functions yourself.
anyAtomicType
anySimpleType
anyType
Both any*Type built-ins can contain any kind of data. Perl decides how to represent the passed values.
error
boolean
Contains true, false, 1 (is true), or 0 (is false). When the writer sees a value equal to 'true' or 'false', those are used. Otherwise, the trueth value is evaluated into '0' or '1'.
true
false
1
0
The reader will return '0' (also when the XML contains the string 'false', to simplify the Perl code) or '1'.
pattern
Schema's define integer types which are derived from the decimal type. These values can grow enormously large, and therefore can only be handled correctly using Math::BigInt. When the translator is built with the sloppy_integers option, this will simplify (speed-up) the produced code considerably: all integers then shall be between -2G and +2G.
decimal
sloppy_integers
integer
An integer with an undertermined (but possibly large) number of digits.
long
A little bit shorter than an integer, but still up-to 19 digits.
negativeInteger
nonNegativeInteger
nonPositiveInteger
positiveInteger
unsignedInt
Just too long to fit in Perl's ints.
unsignedLong
Value up-to 20 digits.
byte
Signed 8-bits value.
int
short
Signed 16-bits value.
unsignedByte
Unsigned 8-bits value.
unsignedShort
unsigned 16-bits value.
Decimals are painful: they can be very large, much larger than Perl's internal floats. Therefore, we need to use Math::BigFloat which are slow but nearly seamlessly invisible in the application.
double
A floating-point value "m x 2**e", where m is an integer whose absolute value is less than 253, and e is an integer between −1074 and 971, inclusive.
The implementation does not limited the double in size, but maps it onto an precissionDecimal (Math::BigFloat) unless sloppy_float is set.
sloppy_float
float
A small floating-point value "m x 2**e" where m is an integer whose absolute value is less than 224, and e is an integer between −149 and 104, inclusive.
The implementation does not limited the float in size, but maps it onto an precissionDecimal (Math::BigFloat) unless sloppy_float is set.
precissionDecimal
Floating point value that closely corresponds to the floating-point decimal datatypes described by IEEE/ANSI754.
base64Binary
In the hash, it will be kept as binary data. In XML, it will be base64 encoded.
hexBinary
In the hash, it will be kept as binary data. In XML, it will be hex encoded, two hex digits per byte.
date
A day, represented in localtime as YYYY-MM-DD or YYYY-MM-DD[-+]HH:mm. When a decimal value is passed, it is interpreted as time value in UTC, and will be formatted as required. When reading, the date string will not be parsed.
YYYY-MM-DD
YYYY-MM-DD[-+]HH:mm
time
dateTime
A moment, represented as "date T time tz?", where date is YYYY-MM-DD, time is HH:MM:SS, and the time-zone tz is either -HH:mm, +HH:mm, or Z for UTC. The time-zone is optional, but can better be used because the default is not defined in the standard. For that reason, the dateTimeStamp got introduced, which requires the timezone.
HH:MM:SS
-HH:mm
+HH:mm
Z
dateTimeStamp
When a decimal value is passed, it is interpreted as time value in UTC, and will be formatted as required. When reading, the date string will not be parsed.
Like dateTime, but with required timezone which means that it is better defined. All other handling is the same.
gDay
Format ---12 or ---12+09:00 (12 days, optional time-zone)
---12
---12+09:00
gMonth
Format --09 or --09+07:00 (9 months, optional time-zone)
--09
--09+07:00
gMonthDay
Format --09-12 or --09-12+07:00 (9 months 12 days, optional time-zone)
--09-12
--09-12+07:00
gYear
Format 2006 or 2006+07:00 (year 2006, optional time-zone)
2006
2006+07:00
gYearMonth
Format 2006-11 or 2006-11+07:00 (november 2006, optional time-zone)
2006-11
2006-11+07:00
An moment in time, as can happen every day.
dayTimeDuration
Format -PnDTnHnMnS, where optional starting - means negative. The P is obligatory, and the T indicates start of a time part. All other n[DHMS] are optional.
-PnDTnHnMnS
-
P
T
n[DHMS]
duration
Format -PnYnMnDTnHnMnS, where optional starting - means negative. The P is obligatory, and the T indicates start of a time part. All other n[YMDHMS] are optional.
-PnYnMnDTnHnMnS
n[YMDHMS]
yearMonthDuration
Format -PnYnMn, where optional starting - means negative. The P is obligatory, the n[YM] are optional.
-PnYnMn
n[YM]
ID(, IDREF, IDREFS)
A label, reference to a label, or set of references.
PARTIAL IMPLEMENTATION: the validity of used characters is not checked.
NCName(, ENTITY, ENTITIES)
A name which contains no colons (a non-colonized name).
Name
language
An RFC3066 language indicator.
normalizedString
String where all sequence of white-spaces (including new-lines) are interpreted as one blank. Blanks at beginning and the end of the string are ignored.
string
(Usually utf8) string.
token(, NMTOKEN, NMTOKENS)
NOTATION
NOT IMPLEMENTED, so treated as string.
QName
A qualified type name: a type name with optional prefix. The prefix notation prefix:type will be translated into the {$ns}type notation.
prefix:type
{$ns}type
For writers, this translation can only happen when the $ns is also in use on some other place in the message: the name-space declaration can not be added at run-time. In other cases, you will get a run-time error. Play with XML::Compile::Schema::compile(prefixes), predefining evenything what may be used, setting the used count to 1.
$ns
used
anyURI
You may pass a string or, for instance, an URI object which will be stringified into an URI. When read, the data will not automatically be translated into an URI object: it may not be used that way.
binary
Perl strings can contain any byte, also nul-strings, so can contain any sequence of bits. Limited to byte length.
timeDuration
'Old' name for duration().
uriReference
Probably the same rules as anyURI().
This module is part of XML-Compile distribution version 1.21, built on December 24, 2010. Website: http://perl.overmeer.net/xml-compile/
Other distributions in this suite: XML::Compile, XML::Compile::SOAP, XML::Compile::SOAP12, XML::Compile::SOAP::Daemon, XML::Compile::SOAP::WSA, XML::Compile::Tester, XML::Compile::Cache, XML::Compile::Dumper, XML::Compile::RPC, XML::Rewrite, XML::eXistDB, and XML::LibXML::Simple.
Please post questions or ideas to the mailinglist at http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile For live contact with other developers, visit the #xml-compile channel on irc.perl.org.
#xml-compile
irc.perl.org
Copyrights 2006-2010 by Mark Overmeer. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in '−1074'. Assuming UTF-8
To install XML::Compile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::Compile
CPAN shell
perl -MCPAN -e shell install XML::Compile
For more information on module installation, please visit the detailed CPAN module installation guide.