[Xml-compile] Using xsi:type with XML::Compile

DEIGNAN Ciaran c.deignan at rsd.com
Tue Aug 28 10:09:25 GMT 2012


Hi Marc,

>> http://search.cpan.org/~markov/XML-Compile-1.26/lib/XML/Compile/Schema.pod
>> However the AUTO mode doesn't seem to work.

>Which version of XML::Compile do you have?  It only got added in 1.25
>The logic is in XML::Compile::Schema::NameSpaces::autoexpand_xsi_type($)
>Also t/75type.t tests that it works.

I'm testing this with XML::Compile 1.25 and XML::Compile::SOAP 2.29.

In autoexpand_xsi_type the hash reference $xi has a table reference as a value. So the test " $xi->{$type} eq 'AUTO'" always fails. 

trace: schema compile READER for {http://www.rsd.com/2011/07/nodemgmt/schema}GetFilePlanResponse
$VAR1 = {
	'{http://www.rsd.com/2011/07/datatype/schema}FilePlanType' => [
		'AUTO'
		]
	};



I can modify this function to loop on the elements and then my application works

    foreach my $type (keys %$xi)
    { # print "Type: ", Dumper($xi->{$type});
    	
    	foreach my $elem (@{$xi->{$type}}) {
    		next unless $elem eq 'AUTO';
        my @ext = $self->findTypeExtensions($type);
        $xi->{$type} = \@ext;
        trace "discovered xsi:type choices for $type:\n  "
          . join("\n  ", @ext);
        last;
       }
      
    }




> Easier:
>   $wsdl->prefix(dt => 'http://www.rsd.com/2011/07/datatype/schema');
>   xsi_type => { 'dt:FilePlanType' => 'dt:rmFilePlanType' }

This doesn't work for me :(
It says :

error: unknown name prefix for `dt:rmFilePlanType'

Ciaran




More information about the Xml-compile mailing list