Program: 66332
Project: 66332
Buggy source:
public void addToSchemaType(TypeInfo ownerTypeInfo,java.util.List<Property> properties,TypeDefParticle compositor,ComplexType type,Schema workingSchema){
  if (properties.size() == 0) {
    type.setAll(null);
    type.setSequence(null);
    type.setChoice(null);
    ownerTypeInfo.setCompositor(null);
  }
 else {
    for (    Property next : properties) {
      if (next == null) {
        continue;
      }
      Schema currentSchema=workingSchema;
      TypeDefParticle parentCompositor=compositor;
      boolean isChoice=(parentCompositor instanceof Choice);
      ComplexType parentType=type;
      if (!helper.isAnnotationPresent(next.getElement(),XmlTransient.class) && !next.isInverseReference()) {
        if (next.getXmlPath() != null) {
          if (next.getXmlPath().equals("String_Node_Str")) {
            TypeInfo info=(TypeInfo)typeInfo.get(next.getActualType().getQualifiedName());
            addToSchemaType(info,info.getPropertyList(),compositor,type,info.getSchema());
            continue;
          }
          XMLField xfld=new XMLField(next.getXmlPath());
          xfld.setNamespaceResolver(currentSchema.getNamespaceResolver());
          xfld.initialize();
          XmlPathResult xpr=buildSchemaComponentsForXPath(xfld.getXPathFragment(),new XmlPathResult(parentCompositor,currentSchema),(next.isAny() || next.isAnyAttribute()),isChoice,next);
          parentCompositor=xpr.particle;
          currentSchema=xpr.schema;
          if (parentCompositor == null) {
            continue;
          }
          if (parentCompositor.getOwner() instanceof ComplexType) {
            parentType=((ComplexType)parentCompositor.getOwner());
          }
        }
 else         if (!isChoice && next.isSetXmlElementWrapper()) {
          XmlElementWrapper wrapper=next.getXmlElementWrapper();
          Element wrapperElement=new Element();
          String name=wrapper.getName();
          if (name.equals("String_Node_Str")) {
            name=next.getPropertyName();
          }
          wrapperElement.setNillable(wrapper.isNillable());
          String wrapperNS=wrapper.getNamespace();
          if (!wrapperNS.equals("String_Node_Str") && !wrapperNS.equals(currentSchema.getTargetNamespace())) {
            wrapperElement.setMinOccurs(Occurs.ONE);
            wrapperElement.setMaxOccurs(Occurs.ONE);
            String prefix=getOrGeneratePrefixForNamespace(wrapperNS,currentSchema);
            wrapperElement.setRef(prefix + "String_Node_Str" + name);
            compositor.addElement(wrapperElement);
            continue;
          }
 else {
            wrapperElement.setName(name);
            if (wrapper.isRequired()) {
              wrapperElement.setMinOccurs(Occurs.ONE);
            }
 else {
              wrapperElement.setMinOccurs(Occurs.ZERO);
            }
            compositor.addElement(wrapperElement);
            ComplexType wrapperType=new ComplexType();
            Sequence wrapperSequence=new Sequence();
            wrapperType.setSequence(wrapperSequence);
            wrapperElement.setComplexType(wrapperType);
            parentType=wrapperType;
            parentCompositor=wrapperSequence;
          }
        }
        if (next.isMixedContent()) {
          parentType.setMixed(true);
        }
        if (next.isAttribute() && !next.isAnyAttribute()) {
          Attribute attribute=new Attribute();
          QName attributeName=next.getSchemaName();
          attribute.setName(attributeName.getLocalPart());
          if (next.isRequired()) {
            attribute.setUse(Attribute.REQUIRED);
          }
          String fixedValue=next.getFixedValue();
          if (fixedValue != null) {
            attribute.setFixed(fixedValue);
          }
          JavaClass javaType=next.getType();
          if (next.getGenericType() != null) {
            javaType=(JavaClass)next.getGenericType();
          }
          TypeInfo info=(TypeInfo)typeInfo.get(next.getType().getQualifiedName());
          String typeName=null;
          if (next.isXmlId()) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else           if (next.isXmlIdRef()) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else           if (info != null && !info.isComplexType()) {
            typeName=info.getSimpleType().getName();
          }
 else {
            typeName=getTypeName(next,javaType,currentSchema);
          }
          if (isCollectionType(next)) {
            SimpleType localType=new SimpleType();
            org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
            list.setItemType(typeName);
            localType.setList(list);
            attribute.setSimpleType(localType);
          }
 else {
            if (typeName != null && !typeName.contains("String_Node_Str")) {
              if (info.getSchema() == currentSchema) {
                String prefix=getPrefixForNamespace(currentSchema.getTargetNamespace(),currentSchema.getNamespaceResolver());
                if (prefix != null) {
                  typeName=prefix + "String_Node_Str" + typeName;
                }
              }
            }
            attribute.setType(typeName);
          }
          String lookupNamespace=currentSchema.getTargetNamespace();
          if (lookupNamespace == null) {
            lookupNamespace="String_Node_Str";
          }
          NamespaceInfo namespaceInfo=getNamespaceInfoForNamespace(lookupNamespace);
          boolean isAttributeFormQualified=true;
          if (namespaceInfo != null) {
            isAttributeFormQualified=namespaceInfo.isAttributeFormQualified();
          }
          if ((isAttributeFormQualified && !attributeName.getNamespaceURI().equals(lookupNamespace)) || (!namespaceInfo.isAttributeFormQualified() && !attributeName.getNamespaceURI().equals("String_Node_Str"))) {
            Schema attributeSchema=this.getSchemaForNamespace(attributeName.getNamespaceURI());
            if (attributeSchema != null && attributeSchema.getTopLevelAttributes().get(attribute.getName()) == null) {
              attributeSchema.getTopLevelAttributes().put(attribute.getName(),attribute);
            }
            addImportIfRequired(currentSchema,attributeSchema,attributeName.getNamespaceURI());
            Attribute reference=new Attribute();
            String prefix=getPrefixForNamespace(attributeName.getNamespaceURI(),currentSchema.getNamespaceResolver());
            if (prefix == null) {
              reference.setRef(attribute.getName());
            }
 else {
              reference.setRef(prefix + "String_Node_Str" + attribute.getName());
            }
            if (parentType.getSimpleContent() != null) {
              parentType.getSimpleContent().getExtension().getOrderedAttributes().add(reference);
            }
 else {
              parentType.getOrderedAttributes().add(reference);
            }
          }
 else {
            if (parentType.getSimpleContent() != null) {
              parentType.getSimpleContent().getExtension().getOrderedAttributes().add(attribute);
            }
 else             if (parentType.getComplexContent() != null) {
              parentType.getComplexContent().getExtension().getOrderedAttributes().add(attribute);
            }
 else {
              parentType.getOrderedAttributes().add(attribute);
            }
          }
        }
 else         if (next.isAnyAttribute()) {
          AnyAttribute anyAttribute=new AnyAttribute();
          anyAttribute.setProcessContents("String_Node_Str");
          anyAttribute.setNamespace("String_Node_Str");
          if (parentType.getSimpleContent() != null) {
            SimpleContent content=parentType.getSimpleContent();
            content.getRestriction().setAnyAttribute(anyAttribute);
          }
 else {
            parentType.setAnyAttribute(anyAttribute);
          }
        }
 else         if (next.isChoice()) {
          Choice choice=new Choice();
          if (next.getGenericType() != null) {
            choice.setMaxOccurs(Occurs.UNBOUNDED);
          }
          ArrayList<Property> choiceProperties=(ArrayList<Property>)next.getChoiceProperties();
          addToSchemaType(ownerTypeInfo,choiceProperties,choice,parentType,currentSchema);
          if (parentCompositor instanceof Sequence) {
            ((Sequence)parentCompositor).addChoice(choice);
          }
 else           if (parentCompositor instanceof Choice) {
            ((Choice)parentCompositor).addChoice(choice);
          }
        }
 else         if (next.isAny()) {
          Any any=new Any();
          any.setNamespace("String_Node_Str");
          if (next.isLax()) {
            any.setProcessContents(Any.LAX);
          }
 else {
            any.setProcessContents("String_Node_Str");
          }
          if (isCollectionType(next)) {
            any.setMinOccurs(Occurs.ZERO);
            any.setMaxOccurs(Occurs.UNBOUNDED);
          }
          if (parentCompositor instanceof Sequence) {
            ((Sequence)parentCompositor).addAny(any);
          }
 else           if (parentCompositor instanceof Choice) {
            ((Choice)parentCompositor).addAny(any);
          }
        }
 else         if (next.isReference()) {
          java.util.List<ElementDeclaration> referencedElements=next.getReferencedElements();
          if (referencedElements.size() == 1) {
            Element element=new Element();
            ElementDeclaration decl=referencedElements.get(0);
            String localName=decl.getElementName().getLocalPart();
            Schema referencedSchema=this.getSchemaForNamespace(decl.getElementName().getNamespaceURI());
            addImportIfRequired(currentSchema,referencedSchema,decl.getElementName().getNamespaceURI());
            String prefix=this.getPrefixForNamespace(decl.getElementName().getNamespaceURI(),currentSchema.getNamespaceResolver());
            if (decl.getScopeClass() == GLOBAL.class) {
              if (prefix == null || prefix.equals("String_Node_Str")) {
                element.setRef(localName);
              }
 else {
                element.setRef(prefix + "String_Node_Str" + localName);
              }
            }
 else {
              element.setType(getTypeName(next,decl.getJavaType(),currentSchema));
              element.setName(localName);
            }
            if (next.getGenericType() != null) {
              element.setMinOccurs(Occurs.ZERO);
              element.setMaxOccurs(Occurs.UNBOUNDED);
            }
            parentCompositor.addElement(element);
          }
 else {
            Choice choice=new Choice();
            if (next.getGenericType() != null) {
              choice.setMaxOccurs(Occurs.UNBOUNDED);
            }
            for (            ElementDeclaration elementDecl : referencedElements) {
              Element element=new Element();
              String localName=elementDecl.getElementName().getLocalPart();
              Schema referencedSchema=this.getSchemaForNamespace(elementDecl.getElementName().getNamespaceURI());
              addImportIfRequired(currentSchema,referencedSchema,elementDecl.getElementName().getNamespaceURI());
              String prefix=this.getPrefixForNamespace(elementDecl.getElementName().getNamespaceURI(),currentSchema.getNamespaceResolver());
              if (elementDecl.getScopeClass() == GLOBAL.class) {
                if (prefix == null || prefix.equals("String_Node_Str")) {
                  element.setRef(localName);
                }
 else {
                  element.setRef(prefix + "String_Node_Str" + localName);
                }
              }
 else {
                element.setType(getTypeName(next,elementDecl.getJavaType(),referencedSchema));
                element.setName(localName);
              }
              choice.addElement(element);
            }
            if (parentCompositor instanceof Sequence) {
              ((Sequence)parentCompositor).addChoice(choice);
            }
 else             if (parentCompositor instanceof Choice) {
              ((Choice)parentCompositor).addChoice(choice);
            }
          }
        }
 else         if (!(ownerTypeInfo.getXmlValueProperty() != null && ownerTypeInfo.getXmlValueProperty() == next)) {
          Element element=new Element();
          if (!(parentCompositor instanceof All)) {
            element.setMinOccurs(next.isRequired() ? Occurs.ONE : Occurs.ZERO);
          }
          element.setNillable(next.isNillable());
          if (next.isSetDefaultValue()) {
            element.setDefaultValue(next.getDefaultValue());
          }
          if (next.getMimeType() != null) {
            element.getAttributesMap().put(XMLConstants.EXPECTED_CONTENT_TYPES_QNAME,next.getMimeType());
          }
          QName elementName=next.getSchemaName();
          JavaClass javaType=next.getActualType();
          boolean isComplexType=false;
          element.setName(elementName.getLocalPart());
          String typeName=null;
          if (next.isXmlId()) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else           if (next.isXmlIdRef()) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else {
            TypeInfo info=(TypeInfo)typeInfo.get(javaType.getQualifiedName());
            if (info != null) {
              isComplexType=info.isComplexType();
              if (isComplexType) {
                typeName=info.getComplexType().getName();
              }
 else               if (info.getSimpleType() != null) {
                typeName=info.getSimpleType().getName();
              }
 else {
                typeName=info.getSchemaTypeName();
              }
              if (typeName == null) {
                if (!info.hasRootElement()) {
                  if (info.isComplexType()) {
                    element.setComplexType(info.getComplexType());
                  }
 else {
                    element.setSimpleType(info.getSimpleType());
                  }
                }
              }
              if (addImportIfRequired(currentSchema,info.getSchema(),info.getClassNamespace())) {
                String prefix=currentSchema.getNamespaceResolver().resolveNamespaceURI(info.getClassNamespace());
                if (prefix != null && !typeName.equals("String_Node_Str")) {
                  typeName=prefix + "String_Node_Str" + typeName;
                }
              }
            }
 else             if (!next.isMap()) {
              typeName=getTypeName(next,javaType,currentSchema);
            }
            if (typeName != null && !typeName.contains("String_Node_Str")) {
              String prefix=getPrefixForNamespace(info.getSchema().getTargetNamespace(),currentSchema.getNamespaceResolver());
              if (prefix != null) {
                typeName=prefix + "String_Node_Str" + typeName;
              }
            }
          }
          if (next.getGenericType() != null) {
            if (next.isXmlList()) {
              SimpleType localSimpleType=new SimpleType();
              org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
              list.setItemType(typeName);
              localSimpleType.setList(list);
              element.setSimpleType(localSimpleType);
            }
 else {
              element.setMaxOccurs(Occurs.UNBOUNDED);
              element.setType(typeName);
            }
          }
 else           if (next.isMap()) {
            ComplexType entryComplexType=new ComplexType();
            Sequence entrySequence=new Sequence();
            Element keyElement=new Element();
            keyElement.setName(Property.DEFAULT_KEY_NAME);
            keyElement.setMinOccurs(Occurs.ZERO);
            JavaClass keyType=next.getKeyType();
            JavaClass valueType=next.getValueType();
            if (keyType == null) {
              keyType=helper.getJavaClass(Object.class);
            }
            if (valueType == null) {
              valueType=helper.getJavaClass(Object.class);
            }
            QName keySchemaType=getSchemaTypeFor(keyType);
            if (keySchemaType != null) {
              TypeInfo targetInfo=this.typeInfo.get(keyType.getQualifiedName());
              if (targetInfo != null) {
                Schema keyElementSchema=this.getSchemaForNamespace(keySchemaType.getNamespaceURI());
                addImportIfRequired(currentSchema,keyElementSchema,keySchemaType.getNamespaceURI());
              }
              String prefix;
              if (keySchemaType.getNamespaceURI().equals(XMLConstants.SCHEMA_URL)) {
                prefix=XMLConstants.SCHEMA_PREFIX;
              }
 else {
                prefix=getPrefixForNamespace(keySchemaType.getNamespaceURI(),currentSchema.getNamespaceResolver());
              }
              if (prefix != null && !prefix.equals("String_Node_Str")) {
                typeName=prefix + "String_Node_Str" + keySchemaType.getLocalPart();
              }
 else {
                typeName=keySchemaType.getLocalPart();
              }
              keyElement.setType(typeName);
            }
            entrySequence.addElement(keyElement);
            Element valueElement=new Element();
            valueElement.setName(Property.DEFAULT_VALUE_NAME);
            valueElement.setMinOccurs(Occurs.ZERO);
            QName valueSchemaType=getSchemaTypeFor(valueType);
            if (valueSchemaType != null) {
              TypeInfo targetInfo=this.typeInfo.get(valueType.getQualifiedName());
              if (targetInfo != null) {
                Schema valueElementSchema=this.getSchemaForNamespace(valueSchemaType.getNamespaceURI());
                addImportIfRequired(currentSchema,valueElementSchema,valueSchemaType.getNamespaceURI());
              }
              String prefix;
              if (valueSchemaType.getNamespaceURI().equals(XMLConstants.SCHEMA_URL)) {
                prefix=XMLConstants.SCHEMA_PREFIX;
              }
 else {
                prefix=getPrefixForNamespace(valueSchemaType.getNamespaceURI(),currentSchema.getNamespaceResolver());
              }
              if (prefix != null && !prefix.equals("String_Node_Str")) {
                typeName=prefix + "String_Node_Str" + valueSchemaType.getLocalPart();
              }
 else {
                typeName=valueSchemaType.getLocalPart();
              }
              valueElement.setType(typeName);
            }
            entrySequence.addElement(valueElement);
            entryComplexType.setSequence(entrySequence);
            JavaClass descriptorClass=helper.getJavaClass(ownerTypeInfo.getDescriptor().getJavaClassName());
            JavaClass mapValueClass=helper.getJavaClass(MapValue.class);
            if (mapValueClass.isAssignableFrom(descriptorClass)) {
              element.setComplexType(entryComplexType);
              element.setMaxOccurs(Occurs.UNBOUNDED);
            }
 else {
              ComplexType complexType=new ComplexType();
              Sequence sequence=new Sequence();
              complexType.setSequence(sequence);
              Element entryElement=new Element();
              entryElement.setName("String_Node_Str");
              entryElement.setMinOccurs(Occurs.ZERO);
              entryElement.setMaxOccurs(Occurs.UNBOUNDED);
              sequence.addElement(entryElement);
              entryElement.setComplexType(entryComplexType);
              element.setComplexType(complexType);
            }
          }
 else {
            element.setType(typeName);
          }
          String lookupNamespace=currentSchema.getTargetNamespace();
          if (lookupNamespace == null) {
            lookupNamespace="String_Node_Str";
          }
          NamespaceInfo namespaceInfo=getNamespaceInfoForNamespace(lookupNamespace);
          boolean isElementFormQualified=false;
          if (namespaceInfo != null) {
            isElementFormQualified=namespaceInfo.isElementFormQualified();
          }
          if ((isElementFormQualified && !elementName.getNamespaceURI().equals(lookupNamespace)) || (!isElementFormQualified && !elementName.getNamespaceURI().equals("String_Node_Str"))) {
            Element reference=new Element();
            reference.setMinOccurs(element.getMinOccurs());
            reference.setMaxOccurs(element.getMaxOccurs());
            Schema attributeSchema=this.getSchemaForNamespace(elementName.getNamespaceURI());
            if (attributeSchema != null && attributeSchema.getTopLevelElements().get(element.getName()) == null) {
              element.setMinOccurs(null);
              element.setMaxOccurs(null);
              attributeSchema.getTopLevelElements().put(element.getName(),element);
            }
            addImportIfRequired(currentSchema,attributeSchema,elementName.getNamespaceURI());
            String prefix=getPrefixForNamespace(elementName.getNamespaceURI(),currentSchema.getNamespaceResolver());
            if (prefix == null) {
              reference.setRef(element.getName());
            }
 else {
              reference.setRef(prefix + "String_Node_Str" + element.getName());
            }
            if (elementExistsInParticle(reference.getName(),reference.getRef(),parentCompositor) == null) {
              parentCompositor.addElement(reference);
            }
          }
 else {
            if (elementExistsInParticle(element.getName(),element.getRef(),parentCompositor) == null) {
              if (next.isPositional()) {
                element.setMaxOccurs(Occurs.UNBOUNDED);
              }
              parentCompositor.addElement(element);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void addToSchemaType(TypeInfo ownerTypeInfo,java.util.List<Property> properties,TypeDefParticle compositor,ComplexType type,Schema workingSchema){
  if (properties.size() == 0) {
    type.setAll(null);
    type.setSequence(null);
    type.setChoice(null);
    ownerTypeInfo.setCompositor(null);
  }
 else {
    for (    Property next : properties) {
      if (next == null) {
        continue;
      }
      Schema currentSchema=workingSchema;
      TypeDefParticle parentCompositor=compositor;
      boolean isChoice=(parentCompositor instanceof Choice);
      ComplexType parentType=type;
      if (!helper.isAnnotationPresent(next.getElement(),XmlTransient.class) && !next.isInverseReference()) {
        if (next.getXmlPath() != null) {
          if (next.getXmlPath().equals("String_Node_Str")) {
            TypeInfo info=(TypeInfo)typeInfo.get(next.getActualType().getQualifiedName());
            addToSchemaType(info,info.getPropertyList(),compositor,type,info.getSchema());
            continue;
          }
          XMLField xfld=new XMLField(next.getXmlPath());
          xfld.setNamespaceResolver(currentSchema.getNamespaceResolver());
          xfld.initialize();
          XmlPathResult xpr=buildSchemaComponentsForXPath(xfld.getXPathFragment(),new XmlPathResult(parentCompositor,currentSchema),(next.isAny() || next.isAnyAttribute()),isChoice,next);
          parentCompositor=xpr.particle;
          currentSchema=xpr.schema;
          if (parentCompositor == null) {
            continue;
          }
          if (parentCompositor.getOwner() instanceof ComplexType) {
            parentType=((ComplexType)parentCompositor.getOwner());
          }
        }
 else         if (!isChoice && next.isSetXmlElementWrapper()) {
          XmlElementWrapper wrapper=next.getXmlElementWrapper();
          Element wrapperElement=new Element();
          String name=wrapper.getName();
          if (name.equals("String_Node_Str")) {
            name=next.getPropertyName();
          }
          wrapperElement.setNillable(wrapper.isNillable());
          String wrapperNS=wrapper.getNamespace();
          if (!wrapperNS.equals("String_Node_Str") && !wrapperNS.equals(currentSchema.getTargetNamespace())) {
            wrapperElement.setMinOccurs(Occurs.ONE);
            wrapperElement.setMaxOccurs(Occurs.ONE);
            String prefix=getOrGeneratePrefixForNamespace(wrapperNS,currentSchema);
            wrapperElement.setRef(prefix + "String_Node_Str" + name);
            compositor.addElement(wrapperElement);
            continue;
          }
 else {
            wrapperElement.setName(name);
            if (wrapper.isRequired()) {
              wrapperElement.setMinOccurs(Occurs.ONE);
            }
 else {
              wrapperElement.setMinOccurs(Occurs.ZERO);
            }
            compositor.addElement(wrapperElement);
            ComplexType wrapperType=new ComplexType();
            Sequence wrapperSequence=new Sequence();
            wrapperType.setSequence(wrapperSequence);
            wrapperElement.setComplexType(wrapperType);
            parentType=wrapperType;
            parentCompositor=wrapperSequence;
          }
        }
        if (next.isMixedContent()) {
          parentType.setMixed(true);
        }
        if (next.isAttribute() && !next.isAnyAttribute()) {
          Attribute attribute=new Attribute();
          QName attributeName=next.getSchemaName();
          attribute.setName(attributeName.getLocalPart());
          if (next.isRequired()) {
            attribute.setUse(Attribute.REQUIRED);
          }
          String fixedValue=next.getFixedValue();
          if (fixedValue != null) {
            attribute.setFixed(fixedValue);
          }
          JavaClass javaType=next.getType();
          if (next.getGenericType() != null) {
            javaType=(JavaClass)next.getGenericType();
          }
          TypeInfo info=(TypeInfo)typeInfo.get(next.getType().getQualifiedName());
          String typeName=null;
          if (next.isXmlId()) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else           if (next.isXmlIdRef()) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else           if (info != null && !info.isComplexType()) {
            typeName=info.getSimpleType().getName();
          }
 else {
            typeName=getTypeName(next,javaType,currentSchema);
          }
          if (isCollectionType(next)) {
            SimpleType localType=new SimpleType();
            org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
            list.setItemType(typeName);
            localType.setList(list);
            attribute.setSimpleType(localType);
          }
 else {
            if (typeName != null && !typeName.contains("String_Node_Str")) {
              if (info.getSchema() == currentSchema) {
                String prefix=getPrefixForNamespace(currentSchema.getTargetNamespace(),currentSchema.getNamespaceResolver());
                if (prefix != null) {
                  typeName=prefix + "String_Node_Str" + typeName;
                }
              }
            }
            attribute.setType(typeName);
          }
          String lookupNamespace=currentSchema.getTargetNamespace();
          if (lookupNamespace == null) {
            lookupNamespace="String_Node_Str";
          }
          NamespaceInfo namespaceInfo=getNamespaceInfoForNamespace(lookupNamespace);
          boolean isAttributeFormQualified=true;
          if (namespaceInfo != null) {
            isAttributeFormQualified=namespaceInfo.isAttributeFormQualified();
          }
          if ((isAttributeFormQualified && !attributeName.getNamespaceURI().equals(lookupNamespace)) || (!namespaceInfo.isAttributeFormQualified() && !attributeName.getNamespaceURI().equals("String_Node_Str"))) {
            Schema attributeSchema=this.getSchemaForNamespace(attributeName.getNamespaceURI());
            if (attributeSchema != null && attributeSchema.getTopLevelAttributes().get(attribute.getName()) == null) {
              attributeSchema.getTopLevelAttributes().put(attribute.getName(),attribute);
            }
            addImportIfRequired(currentSchema,attributeSchema,attributeName.getNamespaceURI());
            Attribute reference=new Attribute();
            String prefix=getPrefixForNamespace(attributeName.getNamespaceURI(),currentSchema.getNamespaceResolver());
            if (prefix == null) {
              reference.setRef(attribute.getName());
            }
 else {
              reference.setRef(prefix + "String_Node_Str" + attribute.getName());
            }
            if (parentType.getSimpleContent() != null) {
              parentType.getSimpleContent().getExtension().getOrderedAttributes().add(reference);
            }
 else {
              parentType.getOrderedAttributes().add(reference);
            }
          }
 else {
            if (parentType.getSimpleContent() != null) {
              parentType.getSimpleContent().getExtension().getOrderedAttributes().add(attribute);
            }
 else             if (parentType.getComplexContent() != null) {
              parentType.getComplexContent().getExtension().getOrderedAttributes().add(attribute);
            }
 else {
              parentType.getOrderedAttributes().add(attribute);
            }
          }
        }
 else         if (next.isAnyAttribute()) {
          AnyAttribute anyAttribute=new AnyAttribute();
          anyAttribute.setProcessContents("String_Node_Str");
          anyAttribute.setNamespace("String_Node_Str");
          if (parentType.getSimpleContent() != null) {
            SimpleContent content=parentType.getSimpleContent();
            content.getRestriction().setAnyAttribute(anyAttribute);
          }
 else {
            parentType.setAnyAttribute(anyAttribute);
          }
        }
 else         if (next.isChoice()) {
          Choice choice=new Choice();
          if (next.getGenericType() != null) {
            choice.setMaxOccurs(Occurs.UNBOUNDED);
          }
          ArrayList<Property> choiceProperties=(ArrayList<Property>)next.getChoiceProperties();
          addToSchemaType(ownerTypeInfo,choiceProperties,choice,parentType,currentSchema);
          if (parentCompositor instanceof Sequence) {
            ((Sequence)parentCompositor).addChoice(choice);
          }
 else           if (parentCompositor instanceof Choice) {
            ((Choice)parentCompositor).addChoice(choice);
          }
        }
 else         if (next.isAny()) {
          Any any=new Any();
          any.setNamespace("String_Node_Str");
          if (next.isLax()) {
            any.setProcessContents(Any.LAX);
          }
 else {
            any.setProcessContents("String_Node_Str");
          }
          if (isCollectionType(next)) {
            any.setMinOccurs(Occurs.ZERO);
            any.setMaxOccurs(Occurs.UNBOUNDED);
          }
          if (parentCompositor instanceof Sequence) {
            ((Sequence)parentCompositor).addAny(any);
          }
 else           if (parentCompositor instanceof Choice) {
            ((Choice)parentCompositor).addAny(any);
          }
        }
 else         if (next.isReference()) {
          java.util.List<ElementDeclaration> referencedElements=next.getReferencedElements();
          if (referencedElements.size() == 1) {
            Element element=new Element();
            ElementDeclaration decl=referencedElements.get(0);
            String localName=decl.getElementName().getLocalPart();
            Schema referencedSchema=this.getSchemaForNamespace(decl.getElementName().getNamespaceURI());
            addImportIfRequired(currentSchema,referencedSchema,decl.getElementName().getNamespaceURI());
            String prefix=this.getPrefixForNamespace(decl.getElementName().getNamespaceURI(),currentSchema.getNamespaceResolver());
            if (decl.getScopeClass() == GLOBAL.class) {
              if (prefix == null || prefix.equals("String_Node_Str")) {
                element.setRef(localName);
              }
 else {
                element.setRef(prefix + "String_Node_Str" + localName);
              }
            }
 else {
              element.setType(getTypeName(next,decl.getJavaType(),currentSchema));
              element.setName(localName);
            }
            if (next.getGenericType() != null) {
              element.setMinOccurs(Occurs.ZERO);
              element.setMaxOccurs(Occurs.UNBOUNDED);
            }
            parentCompositor.addElement(element);
          }
 else {
            Choice choice=new Choice();
            if (next.getGenericType() != null) {
              choice.setMaxOccurs(Occurs.UNBOUNDED);
            }
            for (            ElementDeclaration elementDecl : referencedElements) {
              Element element=new Element();
              String localName=elementDecl.getElementName().getLocalPart();
              Schema referencedSchema=this.getSchemaForNamespace(elementDecl.getElementName().getNamespaceURI());
              addImportIfRequired(currentSchema,referencedSchema,elementDecl.getElementName().getNamespaceURI());
              String prefix=this.getPrefixForNamespace(elementDecl.getElementName().getNamespaceURI(),currentSchema.getNamespaceResolver());
              if (elementDecl.getScopeClass() == GLOBAL.class) {
                if (prefix == null || prefix.equals("String_Node_Str")) {
                  element.setRef(localName);
                }
 else {
                  element.setRef(prefix + "String_Node_Str" + localName);
                }
              }
 else {
                element.setType(getTypeName(next,elementDecl.getJavaType(),referencedSchema));
                element.setName(localName);
              }
              choice.addElement(element);
            }
            if (parentCompositor instanceof Sequence) {
              ((Sequence)parentCompositor).addChoice(choice);
            }
 else             if (parentCompositor instanceof Choice) {
              ((Choice)parentCompositor).addChoice(choice);
            }
          }
        }
 else         if (!(ownerTypeInfo.getXmlValueProperty() != null && ownerTypeInfo.getXmlValueProperty() == next)) {
          Element element=new Element();
          if (!(parentCompositor instanceof All)) {
            element.setMinOccurs(next.isRequired() ? Occurs.ONE : Occurs.ZERO);
          }
          if (next.shouldSetNillable()) {
            element.setNillable(true);
          }
          if (next.isSetDefaultValue()) {
            element.setDefaultValue(next.getDefaultValue());
          }
          if (next.getMimeType() != null) {
            element.getAttributesMap().put(XMLConstants.EXPECTED_CONTENT_TYPES_QNAME,next.getMimeType());
          }
          QName elementName=next.getSchemaName();
          JavaClass javaType=next.getActualType();
          boolean isComplexType=false;
          element.setName(elementName.getLocalPart());
          String typeName=null;
          if (next.isXmlId()) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else           if (next.isXmlIdRef()) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else {
            TypeInfo info=(TypeInfo)typeInfo.get(javaType.getQualifiedName());
            if (info != null) {
              isComplexType=info.isComplexType();
              if (isComplexType) {
                typeName=info.getComplexType().getName();
              }
 else               if (info.getSimpleType() != null) {
                typeName=info.getSimpleType().getName();
              }
 else {
                typeName=info.getSchemaTypeName();
              }
              if (typeName == null) {
                if (!info.hasRootElement()) {
                  if (info.isComplexType()) {
                    element.setComplexType(info.getComplexType());
                  }
 else {
                    element.setSimpleType(info.getSimpleType());
                  }
                }
              }
              if (addImportIfRequired(currentSchema,info.getSchema(),info.getClassNamespace())) {
                String prefix=currentSchema.getNamespaceResolver().resolveNamespaceURI(info.getClassNamespace());
                if (prefix != null && !typeName.equals("String_Node_Str")) {
                  typeName=prefix + "String_Node_Str" + typeName;
                }
              }
            }
 else             if (!next.isMap()) {
              typeName=getTypeName(next,javaType,currentSchema);
            }
            if (typeName != null && !typeName.contains("String_Node_Str")) {
              String prefix=getPrefixForNamespace(info.getSchema().getTargetNamespace(),currentSchema.getNamespaceResolver());
              if (prefix != null) {
                typeName=prefix + "String_Node_Str" + typeName;
              }
            }
          }
          if (next.getGenericType() != null) {
            if (next.isXmlList()) {
              SimpleType localSimpleType=new SimpleType();
              org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
              list.setItemType(typeName);
              localSimpleType.setList(list);
              element.setSimpleType(localSimpleType);
            }
 else {
              element.setMaxOccurs(Occurs.UNBOUNDED);
              element.setType(typeName);
            }
          }
 else           if (next.isMap()) {
            ComplexType entryComplexType=new ComplexType();
            Sequence entrySequence=new Sequence();
            Element keyElement=new Element();
            keyElement.setName(Property.DEFAULT_KEY_NAME);
            keyElement.setMinOccurs(Occurs.ZERO);
            JavaClass keyType=next.getKeyType();
            JavaClass valueType=next.getValueType();
            if (keyType == null) {
              keyType=helper.getJavaClass(Object.class);
            }
            if (valueType == null) {
              valueType=helper.getJavaClass(Object.class);
            }
            QName keySchemaType=getSchemaTypeFor(keyType);
            if (keySchemaType != null) {
              TypeInfo targetInfo=this.typeInfo.get(keyType.getQualifiedName());
              if (targetInfo != null) {
                Schema keyElementSchema=this.getSchemaForNamespace(keySchemaType.getNamespaceURI());
                addImportIfRequired(currentSchema,keyElementSchema,keySchemaType.getNamespaceURI());
              }
              String prefix;
              if (keySchemaType.getNamespaceURI().equals(XMLConstants.SCHEMA_URL)) {
                prefix=XMLConstants.SCHEMA_PREFIX;
              }
 else {
                prefix=getPrefixForNamespace(keySchemaType.getNamespaceURI(),currentSchema.getNamespaceResolver());
              }
              if (prefix != null && !prefix.equals("String_Node_Str")) {
                typeName=prefix + "String_Node_Str" + keySchemaType.getLocalPart();
              }
 else {
                typeName=keySchemaType.getLocalPart();
              }
              keyElement.setType(typeName);
            }
            entrySequence.addElement(keyElement);
            Element valueElement=new Element();
            valueElement.setName(Property.DEFAULT_VALUE_NAME);
            valueElement.setMinOccurs(Occurs.ZERO);
            QName valueSchemaType=getSchemaTypeFor(valueType);
            if (valueSchemaType != null) {
              TypeInfo targetInfo=this.typeInfo.get(valueType.getQualifiedName());
              if (targetInfo != null) {
                Schema valueElementSchema=this.getSchemaForNamespace(valueSchemaType.getNamespaceURI());
                addImportIfRequired(currentSchema,valueElementSchema,valueSchemaType.getNamespaceURI());
              }
              String prefix;
              if (valueSchemaType.getNamespaceURI().equals(XMLConstants.SCHEMA_URL)) {
                prefix=XMLConstants.SCHEMA_PREFIX;
              }
 else {
                prefix=getPrefixForNamespace(valueSchemaType.getNamespaceURI(),currentSchema.getNamespaceResolver());
              }
              if (prefix != null && !prefix.equals("String_Node_Str")) {
                typeName=prefix + "String_Node_Str" + valueSchemaType.getLocalPart();
              }
 else {
                typeName=valueSchemaType.getLocalPart();
              }
              valueElement.setType(typeName);
            }
            entrySequence.addElement(valueElement);
            entryComplexType.setSequence(entrySequence);
            JavaClass descriptorClass=helper.getJavaClass(ownerTypeInfo.getDescriptor().getJavaClassName());
            JavaClass mapValueClass=helper.getJavaClass(MapValue.class);
            if (mapValueClass.isAssignableFrom(descriptorClass)) {
              element.setComplexType(entryComplexType);
              element.setMaxOccurs(Occurs.UNBOUNDED);
            }
 else {
              ComplexType complexType=new ComplexType();
              Sequence sequence=new Sequence();
              complexType.setSequence(sequence);
              Element entryElement=new Element();
              entryElement.setName("String_Node_Str");
              entryElement.setMinOccurs(Occurs.ZERO);
              entryElement.setMaxOccurs(Occurs.UNBOUNDED);
              sequence.addElement(entryElement);
              entryElement.setComplexType(entryComplexType);
              element.setComplexType(complexType);
            }
          }
 else {
            element.setType(typeName);
          }
          String lookupNamespace=currentSchema.getTargetNamespace();
          if (lookupNamespace == null) {
            lookupNamespace="String_Node_Str";
          }
          NamespaceInfo namespaceInfo=getNamespaceInfoForNamespace(lookupNamespace);
          boolean isElementFormQualified=false;
          if (namespaceInfo != null) {
            isElementFormQualified=namespaceInfo.isElementFormQualified();
          }
          if ((isElementFormQualified && !elementName.getNamespaceURI().equals(lookupNamespace)) || (!isElementFormQualified && !elementName.getNamespaceURI().equals("String_Node_Str"))) {
            Element reference=new Element();
            reference.setMinOccurs(element.getMinOccurs());
            reference.setMaxOccurs(element.getMaxOccurs());
            Schema attributeSchema=this.getSchemaForNamespace(elementName.getNamespaceURI());
            if (attributeSchema != null && attributeSchema.getTopLevelElements().get(element.getName()) == null) {
              element.setMinOccurs(null);
              element.setMaxOccurs(null);
              attributeSchema.getTopLevelElements().put(element.getName(),element);
            }
            addImportIfRequired(currentSchema,attributeSchema,elementName.getNamespaceURI());
            String prefix=getPrefixForNamespace(elementName.getNamespaceURI(),currentSchema.getNamespaceResolver());
            if (prefix == null) {
              reference.setRef(element.getName());
            }
 else {
              reference.setRef(prefix + "String_Node_Str" + element.getName());
            }
            if (elementExistsInParticle(reference.getName(),reference.getRef(),parentCompositor) == null) {
              parentCompositor.addElement(reference);
            }
          }
 else {
            if (elementExistsInParticle(element.getName(),element.getRef(),parentCompositor) == null) {
              if (next.isPositional()) {
                element.setMaxOccurs(Occurs.UNBOUNDED);
              }
              parentCompositor.addElement(element);
            }
          }
        }
      }
    }
  }
}