NAME

XML::Schema::Type::Complex - class for complex XML Schema datatypes

SYNOPSIS

    use XML::Schema::Type::Complex;

    my $complex = XML::Schema::Type::Complex->new(
	name       => 'MyComplexType',
	attributes => {
	    attr1  => XML::Schema::Attribute->new(@attr1_opts),
	    attr2  => \@attr2_opts,  # shorthand for above
	    ...
	}
	content    => [ ... ],
	# and more...
    );

    # add new attribute
    my @opts = ( name => 'foo', ... );
    my $attr = XML::Schema::Attribute->new(@opts);
    $complex->attribute($attr);          # calls $attr->name() to get 'foo'
    $complex->attribute($attr, $attr);
    $complex->attribute(name => $attr);
    $complex->attribute(name => \@opts); # creates attribute for you

    ...TODO...
    

DESCRIPTION

This module implements an object class for representing XML Schema complex types. A complex type is one which carries attributes and/or contains other elements.

[ TODO: This documentation is incomplete and mainly contains early design thoughts ]

Instantiating Objects of a Complex Type

The XML::Schema::Type::Simple base class module provides the instance($value) method for instantiating objects of the type (e.g. validating that the input is correct and then activating any scheduled actions).

The XML::Schema::Type::Complex module implements a similar method which can be called as $complex->instance(\%attribs, \@content). Underneath the surface, the process of creating an instantance of an complex types (e.g. an object to represent an XML element) is a little more complicated. Because this module is typically used by an XML::Schema::Parser to instances from XML documents, the instantiation lifecycle closely follows the parser events: start tag, content, end tag.

The three methods for instantiating an element of this class are therefore:

$complex->start(@attribs);
$complex->content(@content);
$complex->end();

Or something like that... (still in development)

AUTHOR

Andy Wardley <abw@kfs.org>

VERSION

This is version $Revision: 1.2 $ of the XML::Schema::Type::Complex, distributed with version 0.1 of the XML::Schema module set.

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.

SEE ALSO

See also XML::Schema and XML::Schema::Type.