1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
[% USE XSD(context) %]
package [% XSD.create_xsd_name(element) %];
use strict;
use warnings;
{ # BLOCK to scope variables
sub get_xmlns { '[% element.get_targetNamespace %]' }
__PACKAGE__->__set_name('[% element.get_name %]');
__PACKAGE__->__set_nillable([% IF (element.get_nillable);
IF (element.get_nillable != 'false'); %]1[% ELSE %]0[% END;
END;
%]);
__PACKAGE__->__set_minOccurs([% element.get_minOccurs %]);
__PACKAGE__->__set_maxOccurs([% element.get_maxOccurs %]);
__PACKAGE__->__set_ref([% IF element.get_ref; %]'[% element.get_ref %]'[% END %]);
[%- IF (type_name = element.get_type); -%]
use base qw(
SOAP::WSDL::XSD::Typelib::Element
[% type = definitions.get_types.0.find_type(element.expand(type_name));
XSD.create_xsd_name(type) %]
);
}
[%- ELSIF (ref = element.get_ref);
ref_from = ref.split(':');
-%]
# element ref="[% ref %]"
use base qw(
[% ref_element = definitions.get_types.0.find_element(element.expand(ref));
XSD.create_xsd_name( ref_element ); %]
);
}
[%- ELSIF (simpleType = element.first_simpleType) %]
# atomic simpleType: <element><simpleType
use base qw(
SOAP::WSDL::XSD::Typelib::Element
);
[% INCLUDE simpleType/contentModel.tt -%]
}
[% ELSIF (complexType = element.first_complexType) %]
use base qw(
SOAP::WSDL::XSD::Typelib::Element
SOAP::WSDL::XSD::Typelib::ComplexType
);
[% INCLUDE complexType/contentModel.tt -%]
} # end of BLOCK
[% END %]
1;
[%# work around for CPAN's indexer, which gets disturbed by pod in templates -%]
[% pod = BLOCK %]=pod[% END -%]
[% head1 = BLOCK %]=head1[% END -%]
[% head2 = BLOCK %]=head2[% END -%]
[% head3 = BLOCK %]=head3[% END -%]
[% pod %]
[% head1 %] NAME
[% XSD.create_xsd_name(element) %]
[% head1 %] DESCRIPTION
Perl data type class for the XML Schema defined element
[% element.get_name %] from the namespace [% element.get_targetNamespace %].
[% INCLUDE POD/annotation.tt(node = element) %]
[% IF (complexType = element.first_complexType);
IF (complexType.get_element); %]
[% head1 %] PROPERTIES
The following properties may be accessed using get_PROPERTY / set_PROPERTY
methods:
=over
[% FOREACH child_element = complexType.get_element -%]
=item * [% XSD.perl_var_name(XSD.element_name(child_element)) %]
$element->set_[% XSD.perl_var_name(XSD.element_name(child_element)) %]($data);
$element->get_[% XSD.perl_var_name(XSD.element_name(child_element)) %]();
[% IF (XSD.perl_var_name(XSD.element_name(child_element)) == child_element.get_name); %]
[% ELSE %]
Note: The name of this property has been altered, because it didn't match
perl's notion of variable/subroutine names. The altered name is used in
perl code only, XML output uses the original name:
[% child_element.get_name %]
[% END %]
[% END; %]
=back
[% END;
END; -%]
[% head1 %] METHODS
[% head2 %] new
my $element = [% XSD.create_xsd_name(element) %]->new($data);
Constructor. The following data structure may be passed to new():
[% indent = ' '; INCLUDE element/POD/structure.tt; %]
[% head1 %] AUTHOR
Generated by SOAP::WSDL
=cut
|