Ayhan Ulusoy > XML-Pastor-1.0.4 > XML::Pastor::Schema::SimpleType

Download:
XML-Pastor-1.0.4.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Source  

NAME ^

XML::Pastor::Schema::SimpleType - Class that represents the META information about a W3C schema simple type.

WARNING ^

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.

ISA ^

This class descends from XML::Pastor::Schema::Type and hence from <XML::Pastor::Schema::Object>.

SYNOPSIS ^

  my $type = XML::Pastor::Schema::SimpleType->new();
  
  $type->setFields(name => 'CountryCode', scope=> 'global', nameIsAutoGenerated=>0);
  $type->base('LocationCode');
  $type->derivedBy('restriction');
  
  print $type->name();  # prints 'CountryCode'.
  print $type->scope(); # prints 'global'.
  print $type->base();  # prints 'LocationCode'.
  print $type->derivedBy();     # prints 'restriction'.

DESCRIPTION ^

XML::Pastor::Schema::SimpleType is a data-oriented object class that reprsents a W3C Simple Type. It is parsed from the W3C schema and is used a building block for the produced schema model. It is also used embedded as class data within the simple classes generated by XML::Pastor. This way, objects of this class contain META information about the W3C schema simple type that they represent.

Like other schema object classes, this is a data-oriented object class, meaning it doesn't have many methods other than a constructor and various accessors.

METHODS ^

CONSTRUCTORS

new()

  $class->new(%fields)

CONSTRUCTOR, overridden.

The new() constructor method instantiates a new object. It is inheritable.

Any -named- fields that are passed as parameters are initialized to those values within the newly created object.

In its overriden form, what this method does is to set the contentType field to 'simple'.

.

ACCESSORS

Inherited accessors

Several accessors are inherited by this class from its ancestors XML::Pastor::Schema::Type and XML::Pastor::Schema::Object. Please see XML::Pastor::Schema::Type and XML::Pastor::Schema::Object for a documentation of those.

Accessors defined here

enumeration()

  my $enum = $object->enumeration();    # GET
  $object->enumeration($enum);          # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

Returns (GET) and expects (SET) a hash reference that represent the enumeration values that the simple type can accept. The hash keys are the enumeration values and the hash values are all set to 1.

This accessor is created by a call to mk_accessors from Class::Accessor.

fractionDigits()

  my $fd = $object->fractionDigits();  # GET
  $object->fractionDigits($fd);        # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

This field, if present, signifies the number of fractional digits that numeric values of this simple type must have. This is obtained directly from the W3C schema and placed here by the parser. It is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

length()

  my $len = $object->length();  # GET
  $object->length($len);        # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

Returns (GET) and expects (SET) an integer value representing the exact string length of the simple type value must have for it to pass validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

itemType()

  my $it = $object->itemType(); # GET
  $object->itemType($it);        # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

Returns (GET) and expects (SET) a string value that represents the type of the items in a 'list' type. A W3C list type is a whitespace separeted list of tokens (called items) which must have a common atomic type. This value is obtained from the W3C schema by the parser and is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

itemClass()

  my $cls = $object->itemClass();       # GET
  $object->itemClass($cls);        # SET

This is NOT a W3C facet. It is computed.

Returns (GET) and expects (SET) a Perl Class name that represents the type of the items in a 'list' type. A W3C list type is a whitespace separeted list of tokens (called items) which must have a common atomic type. This value is computed from the itemType at schema model resolution time and is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

maxExclusive()

  my $max = $object->maxExclusive();  # GET
  $object->maxExclusive($max);        # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

This field, if present, signifies a numeric value that the values of this simple type must be less than. This is obtained directly from the W3C schema and placed here by the parser. It is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

maxInclusive()

  my $max = $object->maxInclusive();  # GET
  $object->maxInclusive($max);        # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

This field, if present, signifies the maximum numeric value that the values of this simple type can have. This is obtained directly from the W3C schema and placed here by the parser. It is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

maxLength()

  my $maxLen = $object->maxLength();  # GET
  $object->maxLength($maxLen);        # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

This field, if present, signifies the maximum string length that the values of this simple type can have. This is obtained directly from the W3C schema and placed here by the parser. It is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

memberTypes()

  my $mt = $object->memberTypes();      # GET
  $object->memberTypes($mt);        # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

This is a whitespace separated list of member type names in the context of a W3C union. The value is retrieved from the W3C schema and further enriched by the implicit (local) type names by the schema parser. It is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

memberClasses()

  my $mc = $object->memberClasses();  # GET
  $object->memberClasses($mc);        # SET

This is NOT a W3C facet. It is computed.

This is a reference to an array of Perl classes each of which represent a type mentioned in "memberTypes()". So it makes sense only in a W3C union context. The value is computed at schema model resolution time. It is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

minExclusive()

  my $min = $object->minExclusive();  # GET
  $object->minExclusive($min);        # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

This field, if present, signifies a numeric value that the values of this simple type must be greater than. This is obtained directly from the W3C schema and placed here by the parser. It is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

minInclusive()

  my $min = $object->minInclusive();  # GET
  $object->minInclusive($min);        # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

This field, if present, signifies the minimum numeric value that the values of this simple type can have. This is obtained directly from the W3C schema and placed here by the parser. It is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

minLength()

  my $minLen = $object->minLength();  # GET
  $object->minLength($minLen);        # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

This field, if present, signifies the minimum string length that the values of this simple type can have. This is obtained directly from the W3C schema and placed here by the parser. It is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

pattern()

  my $pat = $object->pattern();  # GET
  $object->pattern($pat);        # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

This field, if present, gives a W3C regular expression to which the values of this simple type must match. This is obtained directly from the W3C schema and placed here by the parser. It is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

regex()

  my $rgx = $object->regex();  # GET
  $object->regex($rgx);        # SET

This is NOT a W3C facet. But it is used as such internally by XML::Pastor in order to give constraints to builtin types.

This field, if present, gives a Perl regular expression to which the values of this simple type must match. It is similar to the "pattern()" field accept that the regex() field will always be guaranteed to be a Perl regular expression whereas 'pattern' may digresse in the future. This is obtained directly from the W3C schema and placed here by the parser. It is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

totalDigits()

  my $td = $object->totalDigits();  # GET
  $object->totalDigits($td);        # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

This field, if present, signifies the total number of digits that numeric values of this simple type must have. This is obtained directly from the W3C schema and placed here by the parser. It is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

whiteSpace()

  my $ws= $object->whiteSpace();  # GET
  $object->whiteSpace($ws);        # SET

This is a W3C facet. For more information please refer to W3C XML schema documentation.

This field, if present, signifies treatment of whitespace within a the values of this simple type upon validation. Currently, three values are possible => 'preserve'(default), 'collapse', 'replace'. This is obtained directly from the W3C schema and placed here by the parser. It is later used for validation.

This accessor is created by a call to mk_accessors from Class::Accessor.

BUGS & CAVEATS ^

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.

AUTHOR ^

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

COPYRIGHT ^

  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 ^

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

syntax highlighting: