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-&gt;new({
    attributes =&gt; {
	# various ways to define attributes
        foo =&gt; 'string',	
        bar =&gt; XML::Schema::Attribute-&gt;new( {
	    name =&gt; 'bar, 
	    type =&gt; 'string'
	} ),
        baz =&gt; { 
	    name =&gt; 'baz', 
	    type =&gt; 'string',
	},
        boz =&gt; { 
	    # name =&gt; 'boz' implied
	    type =&gt; 'string',
        },
        wiz =&gt; { 
	    type =&gt; 'string', 
	    use  =&gt; 'required',
        },
        waz =&gt; { 
	    type =&gt; 'string', 
	    required =&gt; 1,	# alternate way to specify use
        },
     },
}) || die XML::Schema::Attribute::Group-&gt;error();

# another way (of several) to specify usage
my $group = XML::Schema::Attribute::Group-&gt;new({
    attributes  =&gt; { ... },
    default_use =&gt; 'required',
    optional    =&gt; [ qw( foo bar ) ],
}) || die XML::Schema::Attribute::Group-&gt;error();

# fetch existing and add new attributes
my foo = $group-&gt;attribute('foo');
$group-&gt;attribute( XML::Schema::Attribute-&gt;new( ... ) );
$group-&gt;attribute( name =&gt; 'flic', type =&gt; 'string', use =&gt; 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-&gt;new( name =&gt; 'myGroup' )
     || die XML::Schema::Attribute::Group-&gt;error();

# hash ref of options
my $group = XML::Schema::Attribute::Group-&gt;new( { name =&gt; 'myGroup' } ) 
     || die XML::Schema::Attribute::Group-&gt;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 )