oh, look, ComplexType.pm has cut and paste hash reversing code
from SimpleType.pm. that means that we can cut and paste the fix from SimpleType.pm into ComplexType.pm. how many wrongs make a right? I forget.
This commit is contained in:
1 parent
47dc61bd9e
commit
50c8d5b31f
1 file changed
+12
-3
@@ -98,9 +98,18 @@ sub serialize {
|
|||||||
if ( $opt->{ autotype }) {
|
if ( $opt->{ autotype }) {
|
||||||
my $ns = $self->get_targetNamespace();
|
my $ns = $self->get_targetNamespace();
|
||||||
# reverse namespace by prefix hash
|
# reverse namespace by prefix hash
|
||||||
my %prefix_of = reverse %{ $opt->{ namespace } };
|
|
||||||
my $prefix = $prefix_of{ $ns }
|
# build a list of hash keys (eg '#default', 'tns') whose values match our namespace (eg 'urn:myNamespace')
|
||||||
|| die 'No prefix found for namespace '. $ns;
|
(my @possible_namespace_names) = grep { $opt->{ namespace }->{$_} eq $ns } keys %{ $opt->{ namespace } };
|
||||||
|
|
||||||
|
# put any '#default' option last
|
||||||
|
@possible_namespace_names = sort { $a eq '#default' ? 1 : $b eq '#default' ? -1 : $a cmp $b } @possible_namespace_names;
|
||||||
|
|
||||||
|
if( grep( $_ ne '#default', @possible_namespace_names ) > 1 or ! @possible_namespace_names ) {
|
||||||
|
die "no or too many possible names for our namespace of ``$ns'': ``@possible_namespace_names''; there should be just one and maybe a '#default' entry";
|
||||||
|
}
|
||||||
|
my $prefix = $possible_namespace_names[0];
|
||||||
|
|
||||||
$xml .= join q{}, " type=\"$prefix:", $self->get_name(), '" '
|
$xml .= join q{}, " type=\"$prefix:", $self->get_name(), '" '
|
||||||
if ($self->get_name() );
|
if ($self->get_name() );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user