File: Builtin.pm

package info (click to toggle)
libsoap-wsdl-perl 3.004-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,600 kB
  • sloc: perl: 8,433; xml: 1,769; java: 19; makefile: 15
file content (41 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download | duplicates (2)
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
package SOAP::WSDL::XSD::Builtin;
use strict;
use warnings;
use Class::Std::Fast::Storable;
use base qw(SOAP::WSDL::Base);

our $VERSION = 3.004;

# only used in SOAP::WSDL - will be obsolete once SOAP::WSDL uses the
# generative approach, too

sub serialize {
    my ($self, $name, $value, $opt) = @_;
    my $xml;
    $opt->{ indent } ||= "";
    $opt->{ attributes } ||= [];

    $xml .= $opt->{ indent } if ($opt->{ readable });
    $xml .= '<' . join ' ', $name, @{ $opt->{ attributes } };
    if ( $opt->{ autotype }) {
        my $ns = $self->get_targetNamespace();
        my %prefix_of = reverse %{ $opt->{ namespace } };
        my $prefix = $prefix_of{ $ns }
            || die 'No prefix found for namespace '. $ns;
        $xml .= ' type="' . $prefix . ':'
          . $self->get_name() . '"';
    }

    if (defined $value) {
        $xml .= '>';
        $xml .= "$value";
        $xml .= '</' . $name . '>' ;
    }
    else {
        $xml .= '/>';
    }
    $xml .= "\n" if ($opt->{ readable });
    return $xml;
}

1;