Subject: | derived by extension of complex types elements processing bug |
hi
try to create an empty base complex type and derived class with an
element, create an element named as base complex type and with type of
derived
reader fails when trying to process derived class element, but it should
process it correctly
according to xml schema specification differing attribute declarations
and/or content models would apply to elements with the same name in
different contexts (here context is defined with datatype)
please see test bug_ext_polym.t in attach
test fails with:
error: element `f_a2' not processed at {http://test-types}f_test/f_a3
Subject: | bug_ext_polym.t |
#!/usr/bin/perl
# test complex type extensions
use warnings;
use strict;
use lib 'lib','t';
use TestTools;
use XML::Compile::Schema;
use XML::Compile::Tester;
use Test::More tests => 3;
my $schema = XML::Compile::Schema->new( <<__SCHEMA__ );
<schema targetNamespace="$TestNS"
xmlns="$SchemaNS"
xmlns:me="$TestNS">
<complexType name="f_t1">
<attribute name="f_a1" type="int"/>
</complexType>
<complexType name="f_t2">
<complexContent>
<extension base="me:f_t1">
<sequence>
<element name="f_a2" type="int"/>
</sequence>
</extension>
</complexContent>
</complexType>
<element name="f_test">
<complexType>
<sequence>
<element name="f_a3" type="me:f_t1" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
</schema>
__SCHEMA__
ok(defined $schema);
test_rw($schema, "f_test" => <<__XML, {f_a2 => 4, f_a1 => 18});
<f_test>
<f_a3 type="f_t2" f_a1="18">
<f_a2>4</f_a2>
</f_a3>
</f_test>
__XML