Index: org/exolab/castor/xml/schema/ElementDecl.java =================================================================== --- org/exolab/castor/xml/schema/ElementDecl.java (Revision 6342) +++ org/exolab/castor/xml/schema/ElementDecl.java (Arbeitskopie) @@ -662,6 +662,7 @@ } _parent = parent; } //-- setParent + /** * Sets the reference for this element definition * @param reference the Element definition that this definition references Index: org/exolab/castor/builder/MemberFactory.java =================================================================== --- org/exolab/castor/builder/MemberFactory.java (Revision 6342) +++ org/exolab/castor/builder/MemberFactory.java (Arbeitskopie) @@ -296,6 +296,9 @@ temp.setView(xmlType); ClassInfo typeInfo = resolver.resolve(xmlType); if (typeInfo != null) { + // if we have not processed the referenced by the ClassInfo yet, + // this will return null + // TODO: find a way to resolve an unprocessed ! xsType = typeInfo.getSchemaType(); } else { String className = temp.getQualifiedName(); @@ -332,7 +335,8 @@ //--is the XSType found? if (xsType == null) { - String className = component.getQualifiedName(); + String className; + className = component.getQualifiedName(); JClass jClass = new JClass(className); xsType = new XSClass(jClass); if (xmlType != null && xmlType.isComplexType()) { Index: org/exolab/castor/builder/binding/XMLBindingComponent.java =================================================================== --- org/exolab/castor/builder/binding/XMLBindingComponent.java (Revision 6342) +++ org/exolab/castor/builder/binding/XMLBindingComponent.java (Arbeitskopie) @@ -710,6 +710,17 @@ result = getJavaClassName(); setView(temp); temp = null; + } else if (_config.mappingSchemaType2Java()) { + // deal with (global) element declarations in type mode, + // where no Java class will be generated per definition; + // in this case, the class name to be used should be taken from the + // underlying (complex) type + XMLType xmlType = element.getType(); + if (xmlType != null && xmlType.isComplexType()) { + ComplexType complexType = (ComplexType) xmlType; + setView(complexType); + result = getJavaClassName(); + } } element = null; } @@ -729,6 +740,7 @@ throw new IllegalStateException(err); } } + if (_prefix != null) { result = _prefix + result; }