XML-Schema
view release on metacpan or search on metacpan
lib/XML/Schema/Attribute/Group.pm view on Meta::CPAN
#============================================================= -*-perl-*-
#
# XML::Schema::Attribute::Group.pm
#
# DESCRIPTION
# Module implementing an attribute group which is used by the
# XML::Schema::Type::Complex module to store attributes for a
# complex type, and also to define Attribute Groups within a
# schema to represent relocatable collections of attributes.
#
# AUTHOR
# Andy Wardley <abw@kfs.org>
#
# COPYRIGHT
# Copyright (C) 2001 Canon Research Centre Europe Ltd.
# All Rights Reserved.
#
# This module is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# REVISION
# $Id: Group.pm,v 1.2 2001/12/20 13:26:27 abw Exp $
#
#========================================================================
package XML::Schema::Attribute::Group;
use strict;
use XML::Schema::Scope;
use XML::Schema::Attribute;
use XML::Schema::Constants qw( :attribs );
use base qw( XML::Schema::Scope );
use vars qw( $VERSION $DEBUG $ERROR @MANDATORY @OPTIONAL );
$VERSION = sprintf("%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/);
$DEBUG = 0 unless defined $DEBUG;
$ERROR = '';
@MANDATORY = qw( name );
@OPTIONAL = qw( namespace annotation );
#------------------------------------------------------------------------
# build regexen to match valid attribute usage and constraints values
#------------------------------------------------------------------------
my @USE_OPTS = ( OPTIONAL, REQUIRED, PROHIBITED );
my $USE_REGEX = join('|', @USE_OPTS);
$USE_REGEX = qr/^$USE_REGEX$/;
#------------------------------------------------------------------------
# init(\%config)
#
# Initiliasation method called by base class new() constructor.
# A reference to a hash array of configuration options can be specified
# as shown in this example:
#
# my $group = XML::Schema::Attribute::Group->new({
# attributes => {
# foo => XML::Schema::Attribute->new(...),
# bar => { name => 'bar', type => 'string' }
# baz => { type => 'string' }, # name implied by key 'baz'
# baz => { type => 'string', use => REQUIRED },
# boz => { type => 'string', required => 1 },
# wiz => 'string',
( run in 0.369 second using v1.01-cache-2.11-cpan-5511b514fd6 )