[Xml-compile] xsi:type support

Mark Overmeer mark at overmeer.net
Mon Jan 11 10:01:25 GMT 2010


* Roman Daniel (roman.daniel at davosro.cz) [100111 09:47]:
> Use of uninitialized value in length at /usr/lib/perl5/site_perl/5.8.3/XML/
> Compile/Translate.pm line 677.
> error: cannot find type {http://www.w3.org/2001/XMLSchema}SpecPayloadType at {
> http://m.cz}Response/Payload

For some reason, the tts prefix is not found.  I'll investigate it now.

> my $xs = XML::Compile::Schema->new;
> $xs->importDefinitions($_) for $schema1, $schema2;
> my $r = $xs->compile(
>     READER => "{http://m.cz}Response",
>     xsi_type => {
>         "{http://m.cz}PayloadType" => [ "{http://t.cz}SpecPayloadType" ]
>     }
>     );

Cleaner notation:

  my $xs = XML::Compile::Cache->new;
  $xs->prefixes(m => 'http://m.cz', t => 'http://t.cz');
  $xs->importDefinitions( [$schema1, $schema2] );

  my $r = $xs->compile
    ( READER => "m:Response"
    , xsi_type =>
        { "m:PayloadType" => [ "t:SpecPayloadType" ]
        }
    );

The 'm' and 't' prefixes do not need to agree with the schema's
definition of prefixes.
-- 
Regards,
               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list