On 15 Sep 2008, at 09:55, Mark Overmeer wrote:
* mirod (xmltwig@gmail.com) [080915 08:06]:
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);
}
* mirod (xmltwig@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);
}
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