[Xml-compile] xsi:type support

Roman Daniel roman.daniel at davosro.cz
Mon Jan 11 10:31:53 GMT 2010


works, thanks

2010/1/11 Mark Overmeer <mark at overmeer.net>

> * Roman Daniel (roman.daniel at davosro.cz) [100111 09:47]:
> > maybe I don't understand the xsi:type support in READER.
> > I extracted a simple example from "real world" schema, but the
> compilation
> > failed:
> >
> > 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<http://www.w3.org/2001/X=
MLSchema%7DSpecPayloadType>at {
> > http://m.cz}Response/Payload
>
> The xsi:type builds a switch, on the moment that the schema is processed.
> However, the schema did not know about the namespace for your xsi:type
> extension: it did not have a prefix defined for it.
>
> Simple fix XML/Compile/Translate.pm line 748:
>
>    my %alt =3D ($comptype =3D> $do3);
>    foreach my $alttype (@{$self->{xsi_type}{$comptype}})
>    {   my ($ns, $local) =3D unpack_type $alttype;
>        my $prefix  =3D $node->lookupNamespacePrefix($ns);
>  +      $prefix   ||=3D $self->_registerNSprefix('x', $ns, 1);
>        my $type    =3D length $prefix ? "$prefix:$local" : $local;
>
>        my $doc     =3D $node->ownerDocument;
>        my $altnode =3D $doc->createElementNS(SCHEMA2001, 'element');
>        $altnode->setNamespace($ns =3D> $prefix);
>        $altnode->setAttribute(name =3D> $name);
> --
> Regards,
>
>               MarkOv
>
> ------------------------------------------------------------------------
>       Mark Overmeer MSc                                MARKOV Solutions
>       Mark at Overmeer.net                          solutions at overmeer.net
> http://Mark.Overmeer.net                   http://solutions.overmeer.net
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20100111/1f=
9f700e/attachment.htm


More information about the Xml-compile mailing list