++ed by:

2 PAUSE users

Ayhan Ulusoy


XML::Pastor::Builtin - Module that includes definitions of all XML::Pastor W3C builtin type classes .


This module is used internally by XML::Pastor. You do not normally know much about this module to actually use XML::Pastor. It is documented here for completeness and for XML::Pastor developers. Do not count on the interface of this module. It may change in any of the subsequent releases. You have been warned.


  use XML::Pastor::Builtin;


XML::Pastor::Builtin is a module that includes the definitions of the classes that represent the W3C builtin simple types. These builtin packages are either directly defined here in this module or otherwise they are used by this module so that you don't have to use them in your program once you use this module.

Each builtin type corresponds to a package. So this module defines multiple packages at once. In each of the packages, the XmlSchemaType class data accessor is set with an object of type XML::Pastor::Schema::SimpleType. This object contains the W3C facets that are used during xml validation, such as pattern, minInclusive, and so on. An internal facet called regex (not defined by W3C) is used to give the regex patterns that correspond to the builtin types. The regex facet will be guaranteed to be a Perl regex while the pattern facet (W3C) may divert from Perl regular expressions although they seem identical to me at this time.

All builtin classes descend from XML::Pastor::Builtin::SimpleType which itself descends from XML::Pastor::SimpleType.

There exist some ancestors for groupings of builtin types. For example, all numeric builtin types descend directly or indirecly from XML::Pastor::Builtin::Numeric.

Such groupings are listed below:


Below is an example of how the double type is defined in the XML::Pastor::Builtin::double package.

  package XML::Pastor::Builtin::double;
  our @ISA = qw(XML::Pastor::Builtin::Numeric);

  XML::Pastor::Builtin::double->XmlSchemaType( bless( {
                'class' => 'XML::Pastor::Builtin::double',
                'contentType' => 'simple',
                 'derivedBy' => 'restriction',
                 'name' => 'double|http://www.w3.org/2001/XMLSchema',
                 # Regex shamelessly copied from XML::Validator::Schema by Sam Tregar                 
                 'regex' => qr/^[+-]?(?:(?:INF)|(?:NaN)|(?:\d+(?:\.\d+)?)(?:[eE][+-]?\d+)?)$/,
               }, 'XML::Pastor::Schema::SimpleType' ) );


Below is a list of W3C builtin types defined either directly in this module, or used by it (and so made available through it).

  • anySimpleType defined here in package XML::Pastor::Builtin::anySimpleType;

  • anyURI defined here in package XML::Pastor::Builtin::anyURI;

  • base64Binary defined in XML::Pastor::Builtin::base64Binary

  • boolean defined in XML::Pastor::Builtin::boolean

  • byte defined here in package XML::Pastor::Builtin::byte;

  • date defined in XML::Pastor::Builtin::date

  • dateTime defined in XML::Pastor::Builtin::dateTime

  • decimal defined here in package XML::Pastor::Builtin::decimal;

  • double defined here in package XML::Pastor::Builtin::double;

  • duration defined here in package XML::Pastor::Builtin::duration;

  • ENTITIES defined here in package XML::Pastor::Builtin::ENTITIES;

  • ENTITY defined here in package XML::Pastor::Builtin::ENTITY;

  • float defined here in package XML::Pastor::Builtin::float;

  • gDay defined here in package XML::Pastor::Builtin::gDay;

  • gMonth defined here in package XML::Pastor::Builtin::gMonth;

  • gMonthDay defined here in package XML::Pastor::Builtin::gMonthDay;

  • gYear defined here in package XML::Pastor::Builtin::gYear;

  • gYearMonth defined here in package XML::Pastor::Builtin::gYearMonth;

  • hexBinary defined in XML::Pastor::Builtin::hexBinary

  • ID defined here in package XML::Pastor::Builtin::ID;

  • IDREF defined here in package XML::Pastor::Builtin::IDREF;

  • IDREFS defined here in package XML::Pastor::Builtin::IDREFS;

  • int defined here in package XML::Pastor::Builtin::int;

  • integer defined here in package XML::Pastor::Builtin::integer;

  • language defined here in package XML::Pastor::Builtin::language;

  • long defined here in package XML::Pastor::Builtin::long;

  • Name defined here in package XML::Pastor::Builtin::Name;

  • NCName defined here in package XML::Pastor::Builtin::NCName;

  • negativeInteger defined here in package XML::Pastor::Builtin::negativeInteger;

  • NMTOKEN defined here in package XML::Pastor::Builtin::NMTOKEN;

  • NMTOKENS defined here in package XML::Pastor::Builtin::NMTOKENS;

  • nonNegativeInteger defined here in package XML::Pastor::Builtin::nonNegativeInteger;

  • nonPositiveInteger defined here in package XML::Pastor::Builtin::nonPositiveInteger;

  • normalizedString defined here in package XML::Pastor::Builtin::normalizedString;

  • NOTATION defined here in package XML::Pastor::Builtin::NOTATION;

  • positiveInteger defined here in package XML::Pastor::Builtin::positiveInteger;

  • QName defined here in package XML::Pastor::Builtin::QName;

  • short defined here in package XML::Pastor::Builtin::short;

  • string defined here in package XML::Pastor::Builtin::string;

  • time defined here in package XML::Pastor::Builtin::time;

  • token defined here in package XML::Pastor::Builtin::token;

  • unsignedByte defined here in package XML::Pastor::Builtin::unsignedByte;

  • unsignedInt defined here in package XML::Pastor::Builtin::unsignedInt;

  • unsignedLong defined here in package XML::Pastor::Builtin::unsignedLong;

  • unsignedShort defined here in package XML::Pastor::Builtin::unsignedShort;


There no known bugs at this time, but this doesn't mean there are aren't any. Note that, although some testing was done prior to releasing the module, this should still be considered alpha code. So use it at your own risk.

Note that there may be other bugs or limitations that the author is not aware of.


Ayhan Ulusoy <dev(at)ulusoy(dot)name>


  Copyright (C) 2006-2007 Ayhan Ulusoy. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


See also XML::Pastor, XML::Pastor::ComplexType, XML::Pastor::SimpleType

If you are curious about the implementation, see XML::Pastor::Schema::Parser, XML::Pastor::Schema::Model, XML::Pastor::Generator.

If you really want to dig in, see XML::Pastor::Schema::Attribute, XML::Pastor::Schema::AttributeGroup, XML::Pastor::Schema::ComplexType, XML::Pastor::Schema::Element, XML::Pastor::Schema::Group, XML::Pastor::Schema::List, XML::Pastor::Schema::SimpleType, XML::Pastor::Schema::Type, XML::Pastor::Schema::Object