Hello,
I'm facing this problem using episodes in JAXB.
The base schema is:
<xsd:schema xmlns:xsd="
http://www.w3.org/2001/XMLSchema" targetNamespace="a"
xmlns:a="a"
elementFormDefault="qualified">
<xsd:element name="Container" type="a:ContainerType"/>
<xsd:complexType name="ContainerType">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" ref="a:ValueList"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ValueListType">
<xsd:sequence maxOccurs="unbounded" minOccurs="0">
<xsd:element name="stringa" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ValueList" type="a:ValueListType"/>
</xsd:schema>
It generates the classes: ContainerType, ValueListType, ObjectFactory
+++
The extended schema is:
<xsd:schema xmlns:xsd="
http://www.w3.org/2001/XMLSchema" targetNamespace="b"
xmlns:a="a" xmlns:b="b"
elementFormDefault="qualified">
<xsd:import namespace="a" schemaLocation="a.xsd"/>
<xsd:element name="ValueListExtended" type="b:ValueListExtendedType"
substitutionGroup="a:ValueList"/>
<xsd:complexType name="ValueListExtendedType">
<xsd:complexContent>
<xsd:extension base="a:ValueListType">
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
<xsd:element name="stringb" type="xsd:string"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
It generates the class ValueListExtendedType, ObjectFactory
+++
If I try to unmarshal the following xml, it works as expected:
<Container xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns="a"
xmlns:b="b"
xsi:schemaLocation="b b.xsd">
<ValueList xsi:type="b:ValueListExtendedType">
<stringa>testo</stringa>
<b:stringb>testo</b:stringb>
</ValueList>
</Container>
Trying to unmarshal the following (without xsi:type, but still valid)
results instead in error from the validator (unexpected element (uri:"b",
local:"ValueListExtended"). Expected elements are <{a}ValueList>):
<Container xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns="a"
xmlns:b="b"
xsi:schemaLocation="b b.xsd">
<b:ValueListExtended >
<stringa>testo</stringa>
<b:stringb>testo</b:stringb>
</b:ValueListExtended>
</Container>
Moreover, if I don't use episodes, it works as expected.
Am I missing something?
Thanks in advance,
Enrico
--
View this message in context: http://www.nabble.com/Problem-with-episodes-and-substitutiongroup-tp22804946p22804946.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.