1package SOAP::WSDL::XSD::Builtin; 2use strict; 3use warnings; 4use Class::Std::Fast::Storable; 5use base qw(SOAP::WSDL::Base); 6 7our $VERSION = 3.004; 8 9# only used in SOAP::WSDL - will be obsolete once SOAP::WSDL uses the 10# generative approach, too 11 12sub serialize { 13 my ($self, $name, $value, $opt) = @_; 14 my $xml; 15 $opt->{ indent } ||= ""; 16 $opt->{ attributes } ||= []; 17 18 $xml .= $opt->{ indent } if ($opt->{ readable }); 19 $xml .= '<' . join ' ', $name, @{ $opt->{ attributes } }; 20 if ( $opt->{ autotype }) { 21 my $ns = $self->get_targetNamespace(); 22 my %prefix_of = reverse %{ $opt->{ namespace } }; 23 my $prefix = $prefix_of{ $ns } 24 || die 'No prefix found for namespace '. $ns; 25 $xml .= ' type="' . $prefix . ':' 26 . $self->get_name() . '"'; 27 } 28 29 if (defined $value) { 30 $xml .= '>'; 31 $xml .= "$value"; 32 $xml .= '</' . $name . '>' ; 33 } 34 else { 35 $xml .= '/>'; 36 } 37 $xml .= "\n" if ($opt->{ readable }); 38 return $xml; 39} 40 411; 42