Hello,
I've come across a JAXB validation problem.
Given the following schema:
<xsd:schema>
<xsd:complexType name="FooType">
<xsd:sequence minOccurs="0">
<xsd:element name="Element1" minOccurs="0" type="xsd:string"/>
<xsd:element name="Element2" type="xsd:string"/>
<xsd:element name="Element3" minOccurs="0" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="Foo" type="FooType"/>
</xsd:schema>
the XML document
<Foo>
<Element2>content</Element2>
</Foo>
should be validated successfully. However, JAXB throws the following
exception:
com.sun.msv.verifier.ValidityViolation: tag name "Element2" is not
allowed. Possible tag names are: <Element1>
This occurs only if the sequence itself is optional (i.e. minOccurs=0).
I have searched the mailing list archive and the bug parade but found no
hint wheter the problem has been encountered before.
I have attached a small demo app which allows testing the error.
Best regards,
Albrecht
--
Albrecht Messner Encorus Technologies
Senior Software Engineer Industriestrasse 3
email: Albrecht.Messner_at_encorus.com 70565 Stuttgart
phone: +49 711 / 22061-253 Germany