The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

XML::Compile::Schema::BuiltInTypes - Define handling of built-in data-types

INHERITANCE

 XML::Compile::Schema::BuiltInTypes
   is an Exporter

SYNOPSIS

 # Not for end-users
 use XML::Compile::Schema::BuiltInTypes qw/%builtin_types/;

DESCRIPTION

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.

The implementation certainly does not try to be minimal (using the restriction rules as set in the schema specification), because that would be too slow.

Any

anySimpleType
anyType

Both any*Type built-ins can contain any kind of data. Perl decides how to represent the passed values.

Single

boolean

Contains true, false, 1 (is true), or 0 (is false). Unchecked, the actual value is used. Otherwise, 0 and 1 are preferred for the hash value and true and false in XML.

Big Integers

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.

integer

An integer with an undertermined, but maximally huge number of digits.

negativeInteger
nonNegativeInteger
positiveInteger
nonPositiveInteger
long

A little bit shorter than an integer, but still up-to 19 digits.

unsignedLong

Value up-to 20 digits.

unsignedInt

Just too long to fit in Perl's ints.

Integers

int
short

Signed 16-bits value.

unsigned Short

unsigned 16-bits value.

byte

Signed 8-bits value.

unsignedByte

Unsigned 8-bits value.

precissionDecimal

PARTIAL IMPLEMENTATION. Special values INF and NaN not handled.

Floating-point

PARTIAL IMPLEMENTATION: INF, NaN not handled. The float is not limited in size, but mapped on double.

decimal

Decimals are painful: they can be very large, much larger than Perl's internal floats. The value is therefore kept as string. Use Math::BigFloat when you need calculations. You can also pass such object here.

float

A small floating-point value.

double

A floating-point value.

Binary

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.

Dates

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.

dateTime

A moment, represented in localtime as "date T time tz", where date is YYYY-MM-DD, time is HH:MM:SS and optional, and time-zone tz is either -HH:mm, +HH:mm, or Z for UTC.

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.

gDay

Format ---12 or ---12+9:00 (12 days, optional time-zone)

gMonth

Format --9 or --9+7:00 (9 months, optional time-zone)

gMonthDay

Format --9-12 or --9-12+7:00 (9 months 12 days, optional time-zone)

gYear

Format 2006 or 2006+7:00 (year 2006, optional time-zone)

gYearMonth

Format 2006-11 or 2006-11+7:00 (november 2006, optional time-zone)

Duration

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.

dayTimeDuration

Format -PDTnHnMnS, where optional starting - means negative. The P is obligatory, and the T indicates start of a time part. All other n[DHMS] are optional.

yearMonthDuration

Format -PnYnMn, where optional starting - means negative. The P is obligatory, the n[YM] are optional.

Strings

string

(Usually utf8) string.

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.

language

An RFC3066 language indicator.

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
token, NMTOKEN, NMTOKENS

URI

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.

QName

A qualified type name: a type name with optional prefix.

NOTATION

NOT IMPLEMENTED, so treated as string.

REFERENCES

See the XML::Compile website at http://perl.overmeer.net/xml-compile/ for more details.

COPYRIGHTS

Module version 0.01. Written by Mark Overmeer (mark@overmeer.net). See the ChangeLog for other contributors.

Copyright (c) 2006 by the author(s). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.