Index: src/main/java/org/exolab/castor/xml/schema/ElementDecl.java =================================================================== --- src/main/java/org/exolab/castor/xml/schema/ElementDecl.java (Revision 7364) +++ src/main/java/org/exolab/castor/xml/schema/ElementDecl.java (Arbeitskopie) @@ -870,6 +870,14 @@ private void setSchema(final Schema schema) { _schema = schema; } + + /** + * Indicates whether a type is set for this element definiion. + * @return True if a type is set. + */ + public boolean hasXMLType() { + return (_xmlType != null); + } } //-- Element Index: src/main/java/org/exolab/castor/xml/schema/AttributeDecl.java =================================================================== --- src/main/java/org/exolab/castor/xml/schema/AttributeDecl.java (Revision 7364) +++ src/main/java/org/exolab/castor/xml/schema/AttributeDecl.java (Arbeitskopie) @@ -627,4 +627,12 @@ _schema = schema; } + /** + * Indicates whether a type is set for this element definiion. + * @return True if a type is set. + */ + public boolean hasXMLType() { + return (_simpleType != null); + } + } //-- AttrDecl Index: src/main/java/org/exolab/castor/xml/schema/TypeReference.java =================================================================== --- src/main/java/org/exolab/castor/xml/schema/TypeReference.java (Revision 7364) +++ src/main/java/org/exolab/castor/xml/schema/TypeReference.java (Arbeitskopie) @@ -117,11 +117,16 @@ catch (IllegalArgumentException iax) { exception = iax; } - if (referredType != null) return; //we found it, return it + if (referredType != null) { + return; + } + //-- try to find a complex type - referredType= getSchema().getComplexType(getName()); + referredType = getSchema().getComplexType(getName()); - if (referredType != null) return; //we found it, return it + if (referredType != null) { + return; + } //-- rethrow exception if necessary if (exception != null) throw exception; Index: xmlctf/tests/MasterTestSuite/sourcegenerator/typeResolution/test.xsd =================================================================== --- xmlctf/tests/MasterTestSuite/sourcegenerator/typeResolution/test.xsd (Revision 0) +++ xmlctf/tests/MasterTestSuite/sourcegenerator/typeResolution/test.xsd (Revision 0) @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + Eigenschafts„nderungen: xmlctf\tests\MasterTestSuite\sourcegenerator\typeResolution\test.xsd ___________________________________________________________________ Name: svn:mime-type + text/xml Name: svn:keywords + Id Name: svn:eol-style + native Index: xmlctf/tests/MasterTestSuite/sourcegenerator/typeResolution/TestDescriptor.xml =================================================================== --- xmlctf/tests/MasterTestSuite/sourcegenerator/typeResolution/TestDescriptor.xml (Revision 0) +++ xmlctf/tests/MasterTestSuite/sourcegenerator/typeResolution/TestDescriptor.xml (Revision 0) @@ -0,0 +1,14 @@ + + + Collection of tests for (failing) type resolution + Werner Guttmann + See CASTOR-1917 + basic capability + + test.xsd + + Test Source Generation + true + + + Eigenschafts„nderungen: xmlctf\tests\MasterTestSuite\sourcegenerator\typeResolution\TestDescriptor.xml ___________________________________________________________________ Name: svn:mime-type + text/xml Name: svn:keywords + Id Name: svn:eol-style + native Index: codegen/src/main/java/org/exolab/castor/builder/factory/MemberFactory.java =================================================================== --- codegen/src/main/java/org/exolab/castor/builder/factory/MemberFactory.java (Revision 7364) +++ codegen/src/main/java/org/exolab/castor/builder/factory/MemberFactory.java (Arbeitskopie) @@ -67,6 +67,7 @@ import org.exolab.castor.builder.types.XSClass; import org.exolab.castor.builder.types.XSString; import org.exolab.castor.builder.types.XSType; +import org.exolab.castor.xml.schema.AttributeDecl; import org.exolab.castor.xml.schema.ComplexType; import org.exolab.castor.xml.schema.ElementDecl; import org.exolab.castor.xml.schema.Facet; @@ -333,8 +334,16 @@ //-- treat unspecified type as anyType switch (component.getAnnotated().getStructureType()) { case Structure.ATTRIBUTE: + AttributeDecl attribute = (AttributeDecl) component.getAnnotated(); + if (!attribute.hasXMLType()) { + xsType = new XSClass(SGTypes.OBJECT); + } + break; case Structure.ELEMENT: - xsType = new XSClass(SGTypes.OBJECT); + ElementDecl element = (ElementDecl) component.getAnnotated(); + if (!element.hasXMLType()) { + xsType = new XSClass(SGTypes.OBJECT); + } break; default: // probably a model-group