Hi Alexey, You've found a bug. It arises when a sub-type appears before its base type in the schema document and was caused by a field which wasn't being cleared. It's a one line fix. Just checked it into SVN. You can work around the problem when using 2.7.0 by moving the type declaration for "parameterType" to the bottom of the schema document.
Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] Alexey Loubyansky <[EMAIL PROTECTED]> wrote on 11/01/2005 09:47:20 AM: > Hello! > > I am seeing weird inheritance of annotations in 2.7.0. > > Have a look at the following schema > > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > targetNamespace="urn:jboss:bean-deployer" > xmlns="urn:jboss:bean-deployer" > elementFormDefault="qualified" > attributeFormDefault="unqualified" > version="1.0"> > > <!-- comment this type out to fix annotations --> > <xsd:complexType name="parameterType"> > <xsd:annotation> > </xsd:annotation> > <xsd:complexContent> > <xsd:extension base="annotatedValueType"/> > </xsd:complexContent> > </xsd:complexType> > > <xsd:complexType name="plainValueType"> > <xsd:annotation> > </xsd:annotation> > </xsd:complexType> > > <xsd:complexType name="valueType"> > <xsd:annotation> > </xsd:annotation> > <xsd:complexContent> > <xsd:extension base="plainValueType"/> > </xsd:complexContent> > </xsd:complexType> > > <xsd:complexType name="annotatedValueType"> > <xsd:annotation> > </xsd:annotation> > <xsd:complexContent> > <xsd:extension base="valueType"/> > </xsd:complexContent> > </xsd:complexType> > </xsd:schema> > > And the following code that prints the number of annotations > > XSComplexTypeDefinition type = > (XSComplexTypeDefinition)model.getTypeDefinition("plainValueType", ns); > System.out.println("plainValueType: " + type.getAnnotations().getLength()); > type = (XSComplexTypeDefinition)model.getTypeDefinition("valueType", ns); > System.out.println("valueType: " + type.getAnnotations().getLength()); > type = > (XSComplexTypeDefinition)model.getTypeDefinition("annotatedValueType", ns); > System.out.println("annotatedValueType: " + > type.getAnnotations().getLength()); > > The result that I see is > > plainValueType: 4 > valueType: 3 > annotatedValueType: 2 > > So, plainValueType actually gets annotations of its subclasses. If I > comment out parameterType definition then the output is > > plainValueType: 1 > valueType: 1 > annotatedValueType: 1 > > Any ideas? > > Thanks, > > alex > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]