Rinchi-XMLSchema

 view release on metacpan or  search on metacpan

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

    }
    elsif ($cref eq 'Rinchi::XMLSchema::Union') {
    }
    elsif ($cref eq 'Rinchi::XMLSchema::Unique') {
      $root->{'_identityConstraints'}{$c->name()} = $c;
    }
    elsif ($cref eq 'Rinchi::XMLSchema::WhiteSpace') {
    }
  }
}

#===============================================================================

package Rinchi::XMLSchema::All;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of All class

Rinchi::XMLSchema::All is used for creating XML Schema All objects.

 id = ID
 maxOccurs = 1 : 1
 minOccurs = (0 | 1) : 1
 {any attributes with non-schema namespace ...}>
 Content: (annotation?, element*)

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::All->new();

Create a new Rinchi::XMLSchema::All object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::All::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::All::maxOccurs

=item $value = $Object->maxOccurs([$new_value]);

Set or get value of the 'maxOccurs' attribute.

=cut

sub maxOccurs() {
  my $self = shift;
  if (@_) {
    $self->{'_maxOccurs'} = shift;
  }
  return $self->{'_maxOccurs'};
}

#===============================================================================
# Rinchi::XMLSchema::All::minOccurs

=item $value = $Object->minOccurs([$new_value]);

Set or get value of the 'minOccurs' attribute.

=cut

sub minOccurs() {
  my $self = shift;
  if (@_) {
    $self->{'_minOccurs'} = shift;
  }
  return $self->{'_minOccurs'};
}

#===============================================================================
# Rinchi::XMLSchema::All::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================

package Rinchi::XMLSchema::Any;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Any class

Rinchi::XMLSchema::Any is used for creating XML Schema Any objects.

  id = ID
  maxOccurs = (nonNegativeInteger | unbounded)  : 1
  minOccurs = nonNegativeInteger : 1
  namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) )  : ##any
  processContents = (lax | skip | strict) : strict
  {any attributes with non-schema namespace ...}>
  Content: (annotation?)

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Any->new();

Create a new Rinchi::XMLSchema::Any object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Any::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Any::maxOccurs

=item $value = $Object->maxOccurs([$new_value]);

Set or get value of the 'maxOccurs' attribute.

=cut

sub maxOccurs() {
  my $self = shift;
  if (@_) {
    $self->{'_maxOccurs'} = shift;
  }
  return $self->{'_maxOccurs'};
}

#===============================================================================
# Rinchi::XMLSchema::Any::minOccurs

=item $value = $Object->minOccurs([$new_value]);

Set or get value of the 'minOccurs' attribute.

=cut

sub minOccurs() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_minOccurs'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_minOccurs'};
}

#===============================================================================
# Rinchi::XMLSchema::Any::namespace

=item $value = $Object->namespace([$new_value]);

Set or get value of the 'namespace' attribute.

=cut

sub namespace() {
  my $self = shift;

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

    if (@other_cont) {
      while (@self_cont and @other_cont) {
        my $sc = shift @self_cont;
        my $oc = shift @other_cont;
        return 0 unless($sc->sameAs($oc));
      }
      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::AnyAttribute;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of AnyAttribute class

Rinchi::XMLSchema::AnyAttribute is used for creating XML Schema AnyAttribute objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::AnyAttribute->new();

Create a new Rinchi::XMLSchema::AnyAttribute object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::AnyAttribute::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::AnyAttribute::namespace

=item $value = $Object->namespace([$new_value]);

Set or get value of the 'namespace' attribute.

=cut

sub namespace() {
  my $self = shift;
  if (@_) {
    $self->{'_namespace'} = shift;
  }
  return $self->{'_namespace'};
}

#===============================================================================
# Rinchi::XMLSchema::AnyAttribute::processContents

=item $value = $Object->processContents([$new_value]);

Set or get value of the 'processContents' attribute.

=cut

sub processContents() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^skip|lax|strict$/) {
      $self->{'_processContents'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'skip | lax | strict\'.'
    }
  }
  return $self->{'_processContents'};
}

#===============================================================================
# Rinchi::XMLSchema::AnyAttribute::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

  if (exists($self->{'_processContents'})) {
    if (exists($other->{'_processContents'})) {
      return 0 unless ($self->{'_processContents'} eq $other->{'_processContents'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_processContents'}));
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Appinfo;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Appinfo class

Rinchi::XMLSchema::Appinfo is used for creating XML Schema Appinfo objects.

 source = anyURI
 {any attributes with non-schema namespace ...}>
 Content: ({any})*

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Appinfo->new();

Create a new Rinchi::XMLSchema::Appinfo object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Appinfo::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Appinfo::source

=item $value = $Object->source([$new_value]);

Set or get value of the 'source' attribute.

=cut

sub source() {
  my $self = shift;
  if (@_) {
    $self->{'_source'} = shift;
  }
  return $self->{'_source'};
}

#===============================================================================

package Rinchi::XMLSchema::Attribute;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Attribute class

Rinchi::XMLSchema::Attribute is used for creating XML Schema Attribute objects.

 default = string
 fixed = string
 form = (qualified | unqualified)
 id = ID
 name = NCName
 ref = QName
 type = QName
 use = (optional | prohibited | required) : optional
 {any attributes with non-schema namespace ...}>
 Content: (annotation?, simpleType?)

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Attribute->new();

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN


Set or get value of the 'default' attribute.

=cut

sub default() {
  my $self = shift;
  if (@_) {
    $self->{'_default'} = shift;
  }
  return $self->{'_default'};
}

#===============================================================================
# Rinchi::XMLSchema::Attribute::fixed

=item $value = $Object->fixed([$new_value]);

Set or get value of the 'fixed' attribute.

=cut

sub fixed() {
  my $self = shift;
  if (@_) {
    $self->{'_fixed'} = shift;
  }
  return $self->{'_fixed'};
}

#===============================================================================
# Rinchi::XMLSchema::Attribute::form

=item $value = $Object->form([$new_value]);

Set or get value of the 'form' attribute.

=cut

sub form() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^qualified|unqualified$/) {
      $self->{'_form'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'qualified | unqualified\'.'
    }
  }
  return $self->{'_form'};
}

#===============================================================================
# Rinchi::XMLSchema::Attribute::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Attribute::name

=item $value = $Object->name([$new_value]);

Set or get value of the 'name' attribute.

=cut

sub name() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_name'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting an XML name.'
    }
  }
  return $self->{'_name'};
}

#===============================================================================
# Rinchi::XMLSchema::Attribute::ref

=item $value = $Object->ref([$new_value]);

Set or get value of the 'ref' attribute.

=cut

sub ref() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_ref'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting an XML name.'
    }
  }
  return $self->{'_ref'};
}

#===============================================================================
# Rinchi::XMLSchema::Attribute::type

=item $value = $Object->type([$new_value]);

Set or get value of the 'type' attribute.

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::AttributeGroup;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of AttributeGroup class

Rinchi::XMLSchema::AttributeGroup is used for creating XML Schema AttributeGroup objects.

 id = ID
 name = NCName
 ref = QName
 {any attributes with non-schema namespace ...}>
 Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?))

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::AttributeGroup->new();

Create a new Rinchi::XMLSchema::AttributeGroup object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::AttributeGroup::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::AttributeGroup::name

=item $value = $Object->name([$new_value]);

Set or get value of the 'name' attribute.

=cut

sub name() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_name'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_name'};
}

#===============================================================================
# Rinchi::XMLSchema::AttributeGroup::ref

=item $value = $Object->ref([$new_value]);

Set or get value of the 'ref' attribute.

=cut

sub ref() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_ref'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_ref'};
}

#===============================================================================
# Rinchi::XMLSchema::AttributeGroup::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Choice;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Choice class

Rinchi::XMLSchema::Choice is used for creating XML Schema Choice objects.

 id = ID
 maxOccurs = (nonNegativeInteger | unbounded)  : 1
 minOccurs = nonNegativeInteger : 1
 {any attributes with non-schema namespace ...}>
 Content: (annotation?, (element | group | choice | sequence | any)*)

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Choice->new();

Create a new Rinchi::XMLSchema::Choice object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Choice::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Choice::maxOccurs

=item $value = $Object->maxOccurs([$new_value]);

Set or get value of the 'maxOccurs' attribute.

=cut

sub maxOccurs() {
  my $self = shift;
  if (@_) {
    $self->{'_maxOccurs'} = shift;
  }
  return $self->{'_maxOccurs'};
}

#===============================================================================
# Rinchi::XMLSchema::Choice::minOccurs

=item $value = $Object->minOccurs([$new_value]);

Set or get value of the 'minOccurs' attribute.

=cut

sub minOccurs() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_minOccurs'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_minOccurs'};
}

#===============================================================================
# Rinchi::XMLSchema::Choice::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

    if (@other_cont) {
      while (@self_cont and @other_cont) {
        my $sc = shift @self_cont;
        my $oc = shift @other_cont;
        return 0 unless($sc->sameAs($oc));
      }
      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::ComplexContent;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of ComplexContent class

Rinchi::XMLSchema::ComplexContent is used for creating XML Schema ComplexContent objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::ComplexContent->new();

Create a new Rinchi::XMLSchema::ComplexContent object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::ComplexContent::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::ComplexContent::mixed

=item $value = $Object->mixed([$new_value]);

Set or get value of the 'mixed' attribute.

=cut

sub mixed() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^true|false$/) {
      $self->{'_mixed'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
    }
  }
  return $self->{'_mixed'};
}

#===============================================================================
# Rinchi::XMLSchema::ComplexContent::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_mixed'})) {
    if (exists($other->{'_mixed'})) {
      return 0 unless ($self->{'_mixed'} eq $other->{'_mixed'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_mixed'}));
  }

  my @self_cont = @{$self->{'_content_'}};
  my @other_cont = @{$other->{'_content_'}};
  shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN


Set or get value of the 'abstract' attribute.

=cut

sub abstract() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^true|false$/) {
      $self->{'_abstract'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
    }
  }
  return $self->{'_abstract'};
}

#===============================================================================
# Rinchi::XMLSchema::ComplexType::block

=item $value = $Object->block([$new_value]);

Set or get value of the 'block' attribute.

=cut

sub block() {
  my $self = shift;
  if (@_) {
    $self->{'_block'} = shift;
  }
  return $self->{'_block'};
}

#===============================================================================
# Rinchi::XMLSchema::ComplexType::final

=item $value = $Object->final([$new_value]);

Set or get value of the 'final' attribute.

=cut

sub final() {
  my $self = shift;
  if (@_) {
    $self->{'_final'} = shift;
  }
  return $self->{'_final'};
}

#===============================================================================
# Rinchi::XMLSchema::ComplexType::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::ComplexType::mixed

=item $value = $Object->mixed([$new_value]);

Set or get value of the 'mixed' attribute.

=cut

sub mixed() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^true|false$/) {
      $self->{'_mixed'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
    }
  }
  return $self->{'_mixed'};
}

#===============================================================================
# Rinchi::XMLSchema::ComplexType::name

=item $value = $Object->name([$new_value]);

Set or get value of the 'name' attribute.

=cut

sub name() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_name'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_name'};
}

#===============================================================================
# Rinchi::XMLSchema::ComplexType::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

      }
      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }
  
  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Documentation;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Documentation class

Rinchi::XMLSchema::Documentation is used for creating XML Schema Documentation objects.

 source = anyURI
 xml:lang = language
 {any attributes with non-schema namespace ...}>
 Content: ({any})*

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Documentation->new();

Create a new Rinchi::XMLSchema::Documentation object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Documentation::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Documentation::source

=item $value = $Object->source([$new_value]);

Set or get value of the 'source' attribute.

=cut

sub source() {
  my $self = shift;
  if (@_) {
    $self->{'_source'} = shift;
  }
  return $self->{'_source'};
}

#===============================================================================
# Rinchi::XMLSchema::Documentation::xml:lang

=item $value = $Object->xml_lang([$new_value]);

Set or get value of the 'xml:lang' attribute.

=cut

sub xml_lang() {
  my $self = shift;
  if (@_) {
    $self->{'_xml:lang'} = shift;
  }
  return $self->{'_xml:lang'};
}

#===============================================================================

package Rinchi::XMLSchema::Element;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Element class

Rinchi::XMLSchema::Element is used for creating XML Schema Element objects.

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN


Set or get value of the 'final' attribute.

=cut

sub final() {
  my $self = shift;
  if (@_) {
    $self->{'_final'} = shift;
  }
  return $self->{'_final'};
}

#===============================================================================
# Rinchi::XMLSchema::Element::fixed

=item $value = $Object->fixed([$new_value]);

Set or get value of the 'fixed' attribute.

=cut

sub fixed() {
  my $self = shift;
  if (@_) {
    $self->{'_fixed'} = shift;
  }
  return $self->{'_fixed'};
}

#===============================================================================
# Rinchi::XMLSchema::Element::form

=item $value = $Object->form([$new_value]);

Set or get value of the 'form' attribute.

=cut

sub form() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^qualified|unqualified$/) {
      $self->{'_form'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'qualified | unqualified\'.'
    }
  }
  return $self->{'_form'};
}

#===============================================================================
# Rinchi::XMLSchema::Element::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Element::maxOccurs

=item $value = $Object->maxOccurs([$new_value]);

Set or get value of the 'maxOccurs' attribute.

=cut

sub maxOccurs() {
  my $self = shift;
  if (@_) {
    $self->{'_maxOccurs'} = shift;
  }
  return $self->{'_maxOccurs'};
}

#===============================================================================
# Rinchi::XMLSchema::Element::minOccurs

=item $value = $Object->minOccurs([$new_value]);

Set or get value of the 'minOccurs' attribute.

=cut

sub minOccurs() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_minOccurs'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_minOccurs'};
}

#===============================================================================
# Rinchi::XMLSchema::Element::name

=item $value = $Object->name([$new_value]);

Set or get value of the 'name' attribute.

=cut

sub name() {
  my $self = shift;

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

    if (@other_cont) {
      while (@self_cont and @other_cont) {
        my $sc = shift @self_cont;
        my $oc = shift @other_cont;
        return 0 unless($sc->sameAs($oc));
      }
      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Enumeration;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Enumeration class

Rinchi::XMLSchema::Enumeration is used for creating XML Schema Enumeration objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Enumeration->new();

Create a new Rinchi::XMLSchema::Enumeration object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Enumeration::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Enumeration::value

=item $value = $Object->value([$new_value]);

Set or get value of the 'value' attribute.

=cut

sub value() {
  my $self = shift;
  if (@_) {
    $self->{'_value'} = shift;
  }
  return $self->{'_value'};
}

#===============================================================================
# Rinchi::XMLSchema::Enumeration::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_value'})) {
    if (exists($other->{'_value'})) {
      return 0 unless ($self->{'_value'} eq $other->{'_value'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_value'}));
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Extension;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Extension class

Rinchi::XMLSchema::Extension is used for creating XML Schema Extension objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Extension->new();

Create a new Rinchi::XMLSchema::Extension object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Extension::base

=item $value = $Object->base([$new_value]);

Set or get value of the 'base' attribute.

=cut

sub base() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_base'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_base'};
}

#===============================================================================
# Rinchi::XMLSchema::Extension::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Extension::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_base'})) {
    if (exists($other->{'_base'})) {
      return 0 unless ($self->{'_base'} eq $other->{'_base'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_base'}));
  }

  my @self_cont = @{$self->{'_content_'}};
  my @other_cont = @{$other->{'_content_'}};
  shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
  shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');

  if (@self_cont) {
    if (@other_cont) {
      while (@self_cont and @other_cont) {
        my $sc = shift @self_cont;
        my $oc = shift @other_cont;
        return 0 unless($sc->sameAs($oc));
      }
      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Field;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Field class

Rinchi::XMLSchema::Field is used for creating XML Schema Field objects.

 id = ID
 xpath = a subset of XPath expression, see below
 {any attributes with non-schema namespace ...}>
 Content: (annotation?)

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Field->new();

Create a new Rinchi::XMLSchema::Field object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Field::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Field::xpath

=item $value = $Object->xpath([$new_value]);

Set or get value of the 'xpath' attribute.

=cut

sub xpath() {
  my $self = shift;
  if (@_) {
    $self->{'_xpath'} = shift;
  }
  return $self->{'_xpath'};
}

#===============================================================================
# Rinchi::XMLSchema::Field::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_xpath'})) {
    if (exists($other->{'_xpath'})) {
      return 0 unless ($self->{'_xpath'} eq $other->{'_xpath'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_xpath'}));
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::FractionDigits;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of FractionDigits class

Rinchi::XMLSchema::FractionDigits is used for creating XML Schema FractionDigits objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::FractionDigits->new();

Create a new Rinchi::XMLSchema::FractionDigits object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::FractionDigits::fixed

=item $value = $Object->fixed([$new_value]);

Set or get value of the 'fixed' attribute.

=cut

sub fixed() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^true|false$/) {
      $self->{'_fixed'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
    }
  }
  return $self->{'_fixed'};
}

#===============================================================================
# Rinchi::XMLSchema::FractionDigits::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::FractionDigits::value

=item $value = $Object->value([$new_value]);

Set or get value of the 'value' attribute.

=cut

sub value() {
  my $self = shift;
  if (@_) {
    $self->{'_value'} = shift;
  }
  return $self->{'_value'};
}

#===============================================================================
# Rinchi::XMLSchema::FractionDigits::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_fixed'})) {
    if (exists($other->{'_fixed'})) {
      return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_fixed'}));
  }

  if (exists($self->{'_value'})) {
    if (exists($other->{'_value'})) {
      return 0 unless ($self->{'_value'} eq $other->{'_value'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_value'}));
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Group;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Group class

Rinchi::XMLSchema::Group is used for creating XML Schema Group objects.

 id = ID
 maxOccurs = (nonNegativeInteger | unbounded)  : 1
 minOccurs = nonNegativeInteger : 1
 name = NCName
 ref = QName
 {any attributes with non-schema namespace ...}>
 Content: (annotation?, (all | choice | sequence)?)

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Group->new();

Create a new Rinchi::XMLSchema::Group object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Group::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Group::maxOccurs

=item $value = $Object->maxOccurs([$new_value]);

Set or get value of the 'maxOccurs' attribute.

=cut

sub maxOccurs() {
  my $self = shift;
  if (@_) {
    $self->{'_maxOccurs'} = shift;
  }
  return $self->{'_maxOccurs'};
}

#===============================================================================
# Rinchi::XMLSchema::Group::minOccurs

=item $value = $Object->minOccurs([$new_value]);

Set or get value of the 'minOccurs' attribute.

=cut

sub minOccurs() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_minOccurs'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_minOccurs'};
}

#===============================================================================
# Rinchi::XMLSchema::Group::name

=item $value = $Object->name([$new_value]);

Set or get value of the 'name' attribute.

=cut

sub name() {
  my $self = shift;

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Import;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Import class

Rinchi::XMLSchema::Import is used for creating XML Schema Import objects.

 id = ID
 namespace = anyURI
 schemaLocation = anyURI
 {any attributes with non-schema namespace . . .}>
 Content: (annotation?)

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Import->new();

Create a new Rinchi::XMLSchema::Import object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Import::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Import::namespace

=item $value = $Object->namespace([$new_value]);

Set or get value of the 'namespace' attribute.

=cut

sub namespace() {
  my $self = shift;
  if (@_) {
    $self->{'_namespace'} = shift;
  }
  return $self->{'_namespace'};
}

#===============================================================================
# Rinchi::XMLSchema::Import::schemaLocation

=item $value = $Object->schemaLocation([$new_value]);

Set or get value of the 'schemaLocation' attribute.

=cut

sub schemaLocation() {
  my $self = shift;
  if (@_) {
    $self->{'_schemaLocation'} = shift;
  }
  return $self->{'_schemaLocation'};
}

#===============================================================================
# Rinchi::XMLSchema::Import::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

    if (exists($other->{'_schemaLocation'})) {
      return 0 unless ($self->{'_schemaLocation'} eq $other->{'_schemaLocation'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_schemaLocation'}));
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Include;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Include class

Rinchi::XMLSchema::Include is used for creating XML Schema Include objects.

 id = ID
 schemaLocation = anyURI
 {any attributes with non-schema namespace . . .}>
 Content: (annotation?)

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Include->new();

Create a new Rinchi::XMLSchema::Include object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Include::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Include::schemaLocation

=item $value = $Object->schemaLocation([$new_value]);

Set or get value of the 'schemaLocation' attribute.

=cut

sub schemaLocation() {
  my $self = shift;
  if (@_) {
    $self->{'_schemaLocation'} = shift;
  }
  return $self->{'_schemaLocation'};
}

#===============================================================================
# Rinchi::XMLSchema::Include::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_schemaLocation'})) {
    if (exists($other->{'_schemaLocation'})) {
      return 0 unless ($self->{'_schemaLocation'} eq $other->{'_schemaLocation'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_schemaLocation'}));
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Key;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Key class

Rinchi::XMLSchema::Key is used for creating XML Schema Key objects.

 id = ID
 name = NCName
 {any attributes with non-schema namespace ...}>
 Content: (annotation?, (selector, field+))

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Key->new();

Create a new Rinchi::XMLSchema::Key object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Key::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Key::name

=item $value = $Object->name([$new_value]);

Set or get value of the 'name' attribute.

=cut

sub name() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_name'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_name'};
}

#===============================================================================
# Rinchi::XMLSchema::Key::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_name'})) {
    if (exists($other->{'_name'})) {
      return 0 unless ($self->{'_name'} eq $other->{'_name'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_name'}));
  }

  my @self_cont = @{$self->{'_content_'}};
  my @other_cont = @{$other->{'_content_'}};
  shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Keyref;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Keyref class

Rinchi::XMLSchema::Keyref is used for creating XML Schema Keyref objects.

 id = ID
 name = NCName
 refer = QName
 {any attributes with non-schema namespace ...}>
 Content: (annotation?, (selector, field+))

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Keyref->new();

Create a new Rinchi::XMLSchema::Keyref object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Keyref::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Keyref::name

=item $value = $Object->name([$new_value]);

Set or get value of the 'name' attribute.

=cut

sub name() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_name'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_name'};
}

#===============================================================================
# Rinchi::XMLSchema::Keyref::refer

=item $value = $Object->refer([$new_value]);

Set or get value of the 'refer' attribute.

=cut

sub refer() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_refer'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_refer'};
}

#===============================================================================
# Rinchi::XMLSchema::Keyref::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Length class

Rinchi::XMLSchema::Length is used for creating XML Schema Length objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Length->new();

Create a new Rinchi::XMLSchema::Length object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Length::fixed

=item $value = $Object->fixed([$new_value]);

Set or get value of the 'fixed' attribute.

=cut

sub fixed() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^true|false$/) {
      $self->{'_fixed'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
    }
  }
  return $self->{'_fixed'};
}

#===============================================================================
# Rinchi::XMLSchema::Length::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Length::value

=item $value = $Object->value([$new_value]);

Set or get value of the 'value' attribute.

=cut

sub value() {
  my $self = shift;
  if (@_) {
    $self->{'_value'} = shift;
  }
  return $self->{'_value'};
}

#===============================================================================
# Rinchi::XMLSchema::Length::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_fixed'})) {
    if (exists($other->{'_fixed'})) {
      return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_fixed'}));
  }

  if (exists($self->{'_value'})) {
    if (exists($other->{'_value'})) {
      return 0 unless ($self->{'_value'} eq $other->{'_value'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_value'}));
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::List;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of List class

Rinchi::XMLSchema::List is used for creating XML Schema List objects.

 id = ID
 itemType = QName
 {any attributes with non-schema namespace ...}>
 Content: (annotation?, simpleType?)

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::List->new();

Create a new Rinchi::XMLSchema::List object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::List::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::List::itemType

=item $value = $Object->itemType([$new_value]);

Set or get value of the 'itemType' attribute.

=cut

sub itemType() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_itemType'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_itemType'};
}

#===============================================================================
# Rinchi::XMLSchema::List::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_itemType'})) {
    if (exists($other->{'_itemType'})) {
      return 0 unless ($self->{'_itemType'} eq $other->{'_itemType'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_itemType'}));
  }

  my @self_cont = @{$self->{'_content_'}};
  my @other_cont = @{$other->{'_content_'}};
  shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of MaxExclusive class

Rinchi::XMLSchema::MaxExclusive is used for creating XML Schema MaxExclusive objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::MaxExclusive->new();

Create a new Rinchi::XMLSchema::MaxExclusive object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::MaxExclusive::fixed

=item $value = $Object->fixed([$new_value]);

Set or get value of the 'fixed' attribute.

=cut

sub fixed() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^true|false$/) {
      $self->{'_fixed'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
    }
  }
  return $self->{'_fixed'};
}

#===============================================================================
# Rinchi::XMLSchema::MaxExclusive::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::MaxExclusive::value

=item $value = $Object->value([$new_value]);

Set or get value of the 'value' attribute.

=cut

sub value() {
  my $self = shift;
  if (@_) {
    $self->{'_value'} = shift;
  }
  return $self->{'_value'};
}

#===============================================================================
# Rinchi::XMLSchema::MaxExclusive::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_fixed'})) {
    if (exists($other->{'_fixed'})) {
      return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_fixed'}));
  }

  if (exists($self->{'_value'})) {
    if (exists($other->{'_value'})) {
      return 0 unless ($self->{'_value'} eq $other->{'_value'});
    } else {
      return 0;
    }
  } else {

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of MaxInclusive class

Rinchi::XMLSchema::MaxInclusive is used for creating XML Schema MaxInclusive objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::MaxInclusive->new();

Create a new Rinchi::XMLSchema::MaxInclusive object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::MaxInclusive::fixed

=item $value = $Object->fixed([$new_value]);

Set or get value of the 'fixed' attribute.

=cut

sub fixed() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^true|false$/) {
      $self->{'_fixed'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
    }
  }
  return $self->{'_fixed'};
}

#===============================================================================
# Rinchi::XMLSchema::MaxInclusive::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::MaxInclusive::value

=item $value = $Object->value([$new_value]);

Set or get value of the 'value' attribute.

=cut

sub value() {
  my $self = shift;
  if (@_) {
    $self->{'_value'} = shift;
  }
  return $self->{'_value'};
}

#===============================================================================
# Rinchi::XMLSchema::MaxInclusive::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_fixed'})) {
    if (exists($other->{'_fixed'})) {
      return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_fixed'}));
  }

  if (exists($self->{'_value'})) {
    if (exists($other->{'_value'})) {
      return 0 unless ($self->{'_value'} eq $other->{'_value'});
    } else {
      return 0;
    }
  } else {

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of MaxLength class

Rinchi::XMLSchema::MaxLength is used for creating XML Schema MaxLength objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::MaxLength->new();

Create a new Rinchi::XMLSchema::MaxLength object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::MaxLength::fixed

=item $value = $Object->fixed([$new_value]);

Set or get value of the 'fixed' attribute.

=cut

sub fixed() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^true|false$/) {
      $self->{'_fixed'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
    }
  }
  return $self->{'_fixed'};
}

#===============================================================================
# Rinchi::XMLSchema::MaxLength::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::MaxLength::value

=item $value = $Object->value([$new_value]);

Set or get value of the 'value' attribute.

=cut

sub value() {
  my $self = shift;
  if (@_) {
    $self->{'_value'} = shift;
  }
  return $self->{'_value'};
}

#===============================================================================
# Rinchi::XMLSchema::MaxLength::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_fixed'})) {
    if (exists($other->{'_fixed'})) {
      return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_fixed'}));
  }

  if (exists($self->{'_value'})) {
    if (exists($other->{'_value'})) {
      return 0 unless ($self->{'_value'} eq $other->{'_value'});
    } else {
      return 0;
    }
  } else {

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of MinExclusive class

Rinchi::XMLSchema::MinExclusive is used for creating XML Schema MinExclusive objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::MinExclusive->new();

Create a new Rinchi::XMLSchema::MinExclusive object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::MinExclusive::fixed

=item $value = $Object->fixed([$new_value]);

Set or get value of the 'fixed' attribute.

=cut

sub fixed() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^true|false$/) {
      $self->{'_fixed'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
    }
  }
  return $self->{'_fixed'};
}

#===============================================================================
# Rinchi::XMLSchema::MinExclusive::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::MinExclusive::value

=item $value = $Object->value([$new_value]);

Set or get value of the 'value' attribute.

=cut

sub value() {
  my $self = shift;
  if (@_) {
    $self->{'_value'} = shift;
  }
  return $self->{'_value'};
}

#===============================================================================
# Rinchi::XMLSchema::MinExclusive::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_fixed'})) {
    if (exists($other->{'_fixed'})) {
      return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_fixed'}));
  }

  if (exists($self->{'_value'})) {
    if (exists($other->{'_value'})) {
      return 0 unless ($self->{'_value'} eq $other->{'_value'});
    } else {
      return 0;
    }
  } else {

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of MinInclusive class

Rinchi::XMLSchema::MinInclusive is used for creating XML Schema MinInclusive objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::MinInclusive->new();

Create a new Rinchi::XMLSchema::MinInclusive object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::MinInclusive::fixed

=item $value = $Object->fixed([$new_value]);

Set or get value of the 'fixed' attribute.

=cut

sub fixed() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^true|false$/) {
      $self->{'_fixed'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
    }
  }
  return $self->{'_fixed'};
}

#===============================================================================
# Rinchi::XMLSchema::MinInclusive::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::MinInclusive::value

=item $value = $Object->value([$new_value]);

Set or get value of the 'value' attribute.

=cut

sub value() {
  my $self = shift;
  if (@_) {
    $self->{'_value'} = shift;
  }
  return $self->{'_value'};
}

#===============================================================================
# Rinchi::XMLSchema::MinInclusive::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_fixed'})) {
    if (exists($other->{'_fixed'})) {
      return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_fixed'}));
  }

  if (exists($self->{'_value'})) {
    if (exists($other->{'_value'})) {
      return 0 unless ($self->{'_value'} eq $other->{'_value'});
    } else {
      return 0;
    }
  } else {

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of MinLength class

Rinchi::XMLSchema::MinLength is used for creating XML Schema MinLength objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::MinLength->new();

Create a new Rinchi::XMLSchema::MinLength object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::MinLength::fixed

=item $value = $Object->fixed([$new_value]);

Set or get value of the 'fixed' attribute.

=cut

sub fixed() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^true|false$/) {
      $self->{'_fixed'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
    }
  }
  return $self->{'_fixed'};
}

#===============================================================================
# Rinchi::XMLSchema::MinLength::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::MinLength::value

=item $value = $Object->value([$new_value]);

Set or get value of the 'value' attribute.

=cut

sub value() {
  my $self = shift;
  if (@_) {
    $self->{'_value'} = shift;
  }
  return $self->{'_value'};
}

#===============================================================================
# Rinchi::XMLSchema::MinLength::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_fixed'})) {
    if (exists($other->{'_fixed'})) {
      return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_fixed'}));
  }

  if (exists($self->{'_value'})) {
    if (exists($other->{'_value'})) {
      return 0 unless ($self->{'_value'} eq $other->{'_value'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_value'}));
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Notation;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Notation class

Rinchi::XMLSchema::Notation is used for creating XML Schema Notation objects.

 id = ID
 name = NCName
 public = token
 system = anyURI
 {any attributes with non-schema namespace ...}>
 Content: (annotation?)

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Notation->new();

Create a new Rinchi::XMLSchema::Notation object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Notation::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Notation::name

=item $value = $Object->name([$new_value]);

Set or get value of the 'name' attribute.

=cut

sub name() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_name'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_name'};
}

#===============================================================================
# Rinchi::XMLSchema::Notation::public

=item $value = $Object->public([$new_value]);

Set or get value of the 'public' attribute.

=cut

sub public() {
  my $self = shift;
  if (@_) {
    $self->{'_public'} = shift;
  }
  return $self->{'_public'};
}

#===============================================================================
# Rinchi::XMLSchema::Notation::system

=item $value = $Object->system([$new_value]);

Set or get value of the 'system' attribute.

=cut

sub system() {
  my $self = shift;

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

  } else {
    return 0 if (exists($other->{'_public'}));
  }

  if (exists($self->{'_system'})) {
    if (exists($other->{'_system'})) {
      return 0 unless ($self->{'_system'} eq $other->{'_system'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_system'}));
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Pattern;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Pattern class

Rinchi::XMLSchema::Pattern is used for creating XML Schema Pattern objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Pattern->new();

Create a new Rinchi::XMLSchema::Pattern object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Pattern::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Pattern::value

=item $value = $Object->value([$new_value]);

Set or get value of the 'value' attribute.

=cut

sub value() {
  my $self = shift;
  if (@_) {
    $self->{'_value'} = shift;
  }
  return $self->{'_value'};
}

#===============================================================================
# Rinchi::XMLSchema::Pattern::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_value'})) {
    if (exists($other->{'_value'})) {
      return 0 unless ($self->{'_value'} eq $other->{'_value'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_value'}));
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Redefine;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Redefine class

Rinchi::XMLSchema::Redefine is used for creating XML Schema Redefine objects.

 id = ID
 schemaLocation = anyURI
 {any attributes with non-schema namespace . . .}>
 Content: (annotation | (simpleType | complexType | group | attributeGroup))*

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Redefine->new();

Create a new Rinchi::XMLSchema::Redefine object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Redefine::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Redefine::schemaLocation

=item $value = $Object->schemaLocation([$new_value]);

Set or get value of the 'schemaLocation' attribute.

=cut

sub schemaLocation() {
  my $self = shift;
  if (@_) {
    $self->{'_schemaLocation'} = shift;
  }
  return $self->{'_schemaLocation'};
}

#===============================================================================
# Rinchi::XMLSchema::Redefine::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_schemaLocation'})) {
    if (exists($other->{'_schemaLocation'})) {
      return 0 unless ($self->{'_schemaLocation'} eq $other->{'_schemaLocation'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_schemaLocation'}));
  }

  my @self_cont = @{$self->{'_content_'}};
  my @other_cont = @{$other->{'_content_'}};
  shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
  shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');

  if (@self_cont) {
    if (@other_cont) {

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

our @EXPORT_OK = qw();

=head1 DESCRIPTION of Restriction class

Rinchi::XMLSchema::Restriction is used for creating XML Schema Restriction objects.

 base = QName
 id = ID
 {any attributes with non-schema namespace ...}>
 Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*))

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Restriction->new();

Create a new Rinchi::XMLSchema::Restriction object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Restriction::base

=item $value = $Object->base([$new_value]);

Set or get value of the 'base' attribute.

=cut

sub base() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_base'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_base'};
}

#===============================================================================
# Rinchi::XMLSchema::Restriction::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Restriction::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_base'})) {
    if (exists($other->{'_base'})) {
      return 0 unless ($self->{'_base'} eq $other->{'_base'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_base'}));
  }

  my @self_cont = @{$self->{'_content_'}};
  my @other_cont = @{$other->{'_content_'}};
  shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
  shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');

  if (@self_cont) {
    if (@other_cont) {
      while (@self_cont and @other_cont) {
        my $sc = shift @self_cont;
        my $oc = shift @other_cont;
        return 0 unless($sc->sameAs($oc));
      }
      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }

  return 1;
}

#===============================================================================

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

    if ($_[0] =~ /^#all$|^(extension|restriction|substitution)(\s+(extension|restriction|substitution))*$/) {
      $self->{'_blockDefault'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'#all\' or a list of \'extension | restriction | substitution\'.';
    }
  }
  return $self->{'_blockDefault'};
}

#===============================================================================
# Rinchi::XMLSchema::Schema::elementFormDefault

=item $value = $Object->elementFormDefault([$new_value]);

Set or get value of the 'elementFormDefault' attribute.

=cut

sub elementFormDefault() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^qualified|unqualified$/) {
      $self->{'_elementFormDefault'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'qualified | unqualified\'.'
    }
  }
  return $self->{'_elementFormDefault'};
}

#===============================================================================
# Rinchi::XMLSchema::Schema::finalDefault

=item $value = $Object->finalDefault([$new_value]);

Set or get value of the 'finalDefault' attribute.

=cut

sub finalDefault() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^#all$|^(extension|restriction)(\s+(extension|restriction))*$/) {
      $self->{'_finalDefault'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'#all\' or a list of \'extension | restriction\'.'
    }
  }
  return $self->{'_finalDefault'};
}

#===============================================================================
# Rinchi::XMLSchema::Schema::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Schema::targetNamespace

=item $value = $Object->targetNamespace([$new_value]);

Set or get value of the 'targetNamespace' attribute.

=cut

sub targetNamespace() {
  my $self = shift;
  if (@_) {
    $self->{'_targetNamespace'} = shift;
  }
  return $self->{'_targetNamespace'};
}

#===============================================================================
# Rinchi::XMLSchema::Schema::version

=item $value = $Object->version([$new_value]);

Set or get value of the 'version' attribute.

=cut

sub version() {
  my $self = shift;
  if (@_) {
    $self->{'_version'} = shift;
  }
  return $self->{'_version'};
}

#===============================================================================
# Rinchi::XMLSchema::Schema::xml:lang

=item $value = $Object->xml_lang([$new_value]);

Set or get value of the 'xml:lang' attribute.

=cut

sub xml_lang() {
  my $self = shift;
  if (@_) {
    $self->{'_xml:lang'} = shift;
  }
  return $self->{'_xml:lang'};

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

      }
      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Selector;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Selector class

Rinchi::XMLSchema::Selector is used for creating XML Schema Selector objects.

 id = ID
 xpath = a subset of XPath expression, see below
 {any attributes with non-schema namespace ...}>
 Content: (annotation?)

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Selector->new();

Create a new Rinchi::XMLSchema::Selector object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Selector::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Selector::xpath

=item $value = $Object->xpath([$new_value]);

Set or get value of the 'xpath' attribute.

=cut

sub xpath() {
  my $self = shift;
  if (@_) {
    $self->{'_xpath'} = shift;
  }
  return $self->{'_xpath'};
}

#===============================================================================
# Rinchi::XMLSchema::Selector::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_xpath'})) {
    if (exists($other->{'_xpath'})) {
      return 0 unless ($self->{'_xpath'} eq $other->{'_xpath'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_xpath'}));
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Sequence;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Sequence class

Rinchi::XMLSchema::Sequence is used for creating XML Schema Sequence objects.

 id = ID
 maxOccurs = (nonNegativeInteger | unbounded)  : 1
 minOccurs = nonNegativeInteger : 1
 {any attributes with non-schema namespace ...}>
 Content: (annotation?, (element | group | choice | sequence | any)*)

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Sequence->new();

Create a new Rinchi::XMLSchema::Sequence object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Sequence::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Sequence::maxOccurs

=item $value = $Object->maxOccurs([$new_value]);

Set or get value of the 'maxOccurs' attribute.

=cut

sub maxOccurs() {
  my $self = shift;
  if (@_) {
    $self->{'_maxOccurs'} = shift;
  }
  return $self->{'_maxOccurs'};
}

#===============================================================================
# Rinchi::XMLSchema::Sequence::minOccurs

=item $value = $Object->minOccurs([$new_value]);

Set or get value of the 'minOccurs' attribute.

=cut

sub minOccurs() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_minOccurs'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_minOccurs'};
}

#===============================================================================
# Rinchi::XMLSchema::Sequence::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

    if (@other_cont) {
      while (@self_cont and @other_cont) {
        my $sc = shift @self_cont;
        my $oc = shift @other_cont;
        return 0 unless($sc->sameAs($oc));
      }
      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::SimpleContent;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of SimpleContent class

Rinchi::XMLSchema::SimpleContent is used for creating XML Schema SimpleContent objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::SimpleContent->new();

Create a new Rinchi::XMLSchema::SimpleContent object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::SimpleContent::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::SimpleContent::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  my @self_cont = @{$self->{'_content_'}};
  my @other_cont = @{$other->{'_content_'}};
  shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
  shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');

  if (@self_cont) {
    if (@other_cont) {
      while (@self_cont and @other_cont) {
        my $sc = shift @self_cont;
        my $oc = shift @other_cont;
        return 0 unless($sc->sameAs($oc));
      }
      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::SimpleType;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of SimpleType class

Rinchi::XMLSchema::SimpleType is used for creating XML Schema SimpleType objects.

 final = (#all | List of (list | union | restriction))
 id = ID
 name = NCName
 {any attributes with non-schema namespace ...}>
 Content: (annotation?, (restriction | list | union))

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::SimpleType->new();

Create a new Rinchi::XMLSchema::SimpleType object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::SimpleType::final

=item $value = $Object->final([$new_value]);

Set or get value of the 'final' attribute.

=cut

sub final() {
  my $self = shift;
  if (@_) {
    $self->{'_final'} = shift;
  }
  return $self->{'_final'};
}

#===============================================================================
# Rinchi::XMLSchema::SimpleType::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::SimpleType::name

=item $value = $Object->name([$new_value]);

Set or get value of the 'name' attribute.

=cut

sub name() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_name'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_name'};
}

#===============================================================================
# Rinchi::XMLSchema::SimpleType::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;
  
  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_final'})) {
    if (exists($other->{'_final'})) {
      return 0 unless ($self->{'_final'} eq $other->{'_final'});
    } else {
      return 0;
    }  
  } else {
    return 0 if (exists($other->{'_final'}));
  }

  if (exists($self->{'_name'})) {
    if (exists($other->{'_name'})) {
      return 0 unless ($self->{'_name'} eq $other->{'_name'});

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of TotalDigits class

Rinchi::XMLSchema::TotalDigits is used for creating XML Schema TotalDigits objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::TotalDigits->new();

Create a new Rinchi::XMLSchema::TotalDigits object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::TotalDigits::fixed

=item $value = $Object->fixed([$new_value]);

Set or get value of the 'fixed' attribute.

=cut

sub fixed() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^true|false$/) {
      $self->{'_fixed'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
    }
  }
  return $self->{'_fixed'};
}

#===============================================================================
# Rinchi::XMLSchema::TotalDigits::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::TotalDigits::value

=item $value = $Object->value([$new_value]);

Set or get value of the 'value' attribute.

=cut

sub value() {
  my $self = shift;
  if (@_) {
    $self->{'_value'} = shift;
  }
  return $self->{'_value'};
}

#===============================================================================
# Rinchi::XMLSchema::TotalDigits::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_fixed'})) {
    if (exists($other->{'_fixed'})) {
      return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_fixed'}));
  }

  if (exists($self->{'_value'})) {
    if (exists($other->{'_value'})) {
      return 0 unless ($self->{'_value'} eq $other->{'_value'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_value'}));
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Union;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Union class

Rinchi::XMLSchema::Union is used for creating XML Schema Union objects.

 id = ID
 memberTypes = List of QName
 {any attributes with non-schema namespace ...}>
 Content: (annotation?, simpleType*)

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Union->new();

Create a new Rinchi::XMLSchema::Union object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Union::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Union::memberTypes

=item $value = $Object->memberTypes([$new_value]);

Set or get value of the 'memberTypes' attribute.

=cut

sub memberTypes() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+(\s+[-0-9A-Za-z_.:]+)*$/) {
      $self->{'_memberTypes'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKENS.'
    }
  }
  return $self->{'_memberTypes'};
}

#===============================================================================
# Rinchi::XMLSchema::Union::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_memberTypes'})) {
    if (exists($other->{'_memberTypes'})) {
      return 0 unless ($self->{'_memberTypes'} eq $other->{'_memberTypes'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_memberTypes'}));
  }

  my @self_cont = @{$self->{'_content_'}};
  my @other_cont = @{$other->{'_content_'}};
  shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

      }
      return (0) if (@self_cont or @other_cont);
    } else {
      return 0;
    }  
  } else {
    return 0 if (@other_cont);
  }

  return 1;
}

#===============================================================================

package Rinchi::XMLSchema::Unique;

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of Unique class

Rinchi::XMLSchema::Unique is used for creating XML Schema Unique objects.

 id = ID
 name = NCName
 {any attributes with non-schema namespace ...}>
 Content: (annotation?, (selector, field+))

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::Unique->new();

Create a new Rinchi::XMLSchema::Unique object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::Unique::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::Unique::name

=item $value = $Object->name([$new_value]);

Set or get value of the 'name' attribute.

=cut

sub name() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
      $self->{'_name'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
    }
  }
  return $self->{'_name'};
}

#===============================================================================
# Rinchi::XMLSchema::Unique::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_name'})) {
    if (exists($other->{'_name'})) {
      return 0 unless ($self->{'_name'} eq $other->{'_name'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_name'}));
  }

  my @self_cont = @{$self->{'_content_'}};
  my @other_cont = @{$other->{'_content_'}};
  shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');

lib/Rinchi/XMLSchema.pm  view on Meta::CPAN

use Carp;

our @ISA = qw(Rinchi::XMLSchema);

our @EXPORT = qw();
our @EXPORT_OK = qw();

=head1 DESCRIPTION of WhiteSpace class

Rinchi::XMLSchema::WhiteSpace is used for creating XML Schema WhiteSpace objects.

=cut

#===============================================================================

=item $Object = Rinchi::XMLSchema::WhiteSpace->new();

Create a new Rinchi::XMLSchema::WhiteSpace object.

=cut

sub new() {
  my $class = shift;
  $class = ref($class) || $class;
  my $self = {};
  bless($self,$class);
  $self->{'_content_'} = [];
  return $self;
}

#===============================================================================
# Rinchi::XMLSchema::WhiteSpace::fixed

=item $value = $Object->fixed([$new_value]);

Set or get value of the 'fixed' attribute.

=cut

sub fixed() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^true|false$/) {
      $self->{'_fixed'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
    }
  }
  return $self->{'_fixed'};
}

#===============================================================================
# Rinchi::XMLSchema::WhiteSpace::id

=item $value = $Object->id([$new_value]);

Set or get value of the 'id' attribute.

=cut

sub id() {
  my $self = shift;
  if (@_) {
    if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
      $self->{'_id'} = shift;
    } else {
      carp 'Found value \'' . $_[0] . '\', expecting ID.'
    }
  }
  return $self->{'_id'};
}

#===============================================================================
# Rinchi::XMLSchema::WhiteSpace::value

=item $value = $Object->value([$new_value]);

Set or get value of the 'value' attribute.

=cut

sub value() {
  my $self = shift;
  if (@_) {
    $self->{'_value'} = shift;
  }
  return $self->{'_value'};
}

#===============================================================================
# Rinchi::XMLSchema::WhiteSpace::sameAs

=item $value = $Object->sameAs($other);

Compares self to other returning 1 if they are the same, 0 otherwise;

=cut

sub sameAs() {
  my $self = shift @_;
  my $other = shift @_;

  return 0 unless (ref($other) eq ref($self));

  if (exists($self->{'_fixed'})) {
    if (exists($other->{'_fixed'})) {
      return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
    } else {
      return 0;
    }
  } else {
    return 0 if (exists($other->{'_fixed'}));
  }

  if (exists($self->{'_value'})) {
    if (exists($other->{'_value'})) {
      return 0 unless ($self->{'_value'} eq $other->{'_value'});
    } else {
      return 0;
    }
  } else {



( run in 2.452 seconds using v1.01-cache-2.11-cpan-800906f7e73 )