XML-Schema
view release on metacpan or search on metacpan
docs/html/modules/XML/Schema/Attribute/Group.html view on Meta::CPAN
</tr>
</table>
</ul>
<hr width="100%" size="1" noshade="1"><a name="section_Synopsis"><h2>Synopsis</h2></a>
<ul><pre><p>use XML::Schema::Attribute::Group;
# create an attribute group
my $group = XML::Schema::Attribute::Group->new({
attributes => {
# various ways to define attributes
foo => 'string',
bar => XML::Schema::Attribute->new( {
name => 'bar,
type => 'string'
} ),
baz => {
name => 'baz',
type => 'string',
},
boz => {
# name => 'boz' implied
type => 'string',
},
wiz => {
type => 'string',
use => 'required',
},
waz => {
type => 'string',
required => 1, # alternate way to specify use
},
},
}) || die XML::Schema::Attribute::Group->error();
# another way (of several) to specify usage
my $group = XML::Schema::Attribute::Group->new({
attributes => { ... },
default_use => 'required',
optional => [ qw( foo bar ) ],
}) || die XML::Schema::Attribute::Group->error();
# fetch existing and add new attributes
my foo = $group->attribute('foo');
$group->attribute( XML::Schema::Attribute->new( ... ) );
$group->attribute( name => 'flic', type => 'string', use => REQUIRED );</b></pre></ul>
<hr width="100%" size="1" noshade="1"><a name="section_Description"><h2>Description</h2></a>
<p>
This module implements an object class for representing XML
attribute groups within XML Schema. An attribute group defines a
collection of attributes and their usage constraints (e.g
OPTIONAL, REQUIRED or PROHIBITED). A <a href="../../../../modules/XML/Schema/Type/Complex.html">complex type</a> definition
uses an attribute group to define the acceptable attributes for
elements of that type. Attribute groups can also be defined as
independant entities to represent a relocatable collection of
attributes that can be reused in different complex type definitions
as required.
</p>
<p>
For further information on attribute groups, please consult the
W3C XML Schema specification.
</p>
<hr width="100%" size="1" noshade="1"><a name="section_Methods"><h2>Methods</h2></a><ul>
<li><p>
<a name="method_new"><b>new()</b></a>
<br>
<p>
Constructor method called to create a new attribute group. A
list of '<code><b>key => value</b></code>
' pairs can be
specified as command line arguments, or alternately, a hash
reference can be passed which contains these configuration
values. The method returns a newly instantiated object on
success. On error it returns undef and sets an internal error
message which can be retrieved by calling <a href="../../../../modules/XML/Schema/Base.html#method_error"><code><b>error()</b></code></a> as a class method.
<ul><pre><p># list of options
my $group = XML::Schema::Attribute::Group->new( name => 'myGroup' )
|| die XML::Schema::Attribute::Group->error();
# hash ref of options
my $group = XML::Schema::Attribute::Group->new( { name => 'myGroup' } )
|| die XML::Schema::Attribute::Group->error();</b></pre></ul>
</p>
<p>
The following configuration options may be specifed:
</p>
<p>
<!-- table -->
<table border="0" cellpadding="4" cellspacing="1"
bgcolor="#000044">
<!-- table content -->
<tr bgcolor="#ccccff">
<td><b><small>Name</b></td><td><b><small>Typical Values</b></td><td><b><small>Description</b></td></tr>
<tr valign="top" bgcolor="#eeeeff">
<td>
<a name="config_name"><code><b>name</b></code></a>
</td>
<td>
<code><b>'myGroup'</b></code>
</td>
<td>
The name of the attribute group.
( run in 0.508 second using v1.01-cache-2.11-cpan-5511b514fd6 )