[Xml-compile] Re: XML::Compile: xsi:type support in schema

Drew Taylor drew at drewtaylor.com
Wed Sep 24 10:04:52 BST 2008


On 15 Sep 2008, at 09:55, Mark Overmeer wrote:

> * mirod (xmltwig at gmail.com) [080915 08:06]:
>> <eb:PaymentMethod xsi:type="eb:UniversalBankTransactionType">
>
> Probably, you should address this like: (untested)
>
>  use XML::Compile::Util 'SCHEMA2001i';
>
>  my $xml  = XML::Compile->dataToXML($msg);
>  my $root = $xml->documentElement;
>  my $type = $root->getAttributeNS(SCHEMA2001i, 'type');
>  my ($prefix) = $type =~ s/(.*)\://;
>  my $ns   = $root->namespaceURI($prefix);
>
>  if($type eq 'UniversalBankTransactionType')
>  {   my $call = $schema->compile(READER => "{$ns}$type");
>      my $data = $call->($root);
>  }

So continuing this thread, I have a schema (XFT) which makes extensive  
use of xsi:type attributes on many elements besides the root element.  
I hate this schema with a passion, but I have to work with it. An  
example looks like:

    <Segment xsi:type="SegmentProductType">
       <Code Value="R2Y"></Code>
       <Segments>
         <Segment xsi:type="SegmentStayType">
           <Begins>
.....

Is there any chance that this will be supported in the near future? My  
employer will consider sponsoring the development of the feature if  
that will help. :-)

Thanks,
Drew



More information about the Xml-compile mailing list