- if (parentElement != null) {
- //QName parentType = parentElement.getType();
- String parentNs = elementNsMap.get(parentElement);
- sameNameSpace =currentNS.equals(parentNs);
- if (!sameNameSpace) {
- Schema ps = getOrCreateSchema(parentNs);
- addSchemaDependency(ps, s);
- }
-
- }
- if (schemaElement == null) {
- LocalElement localElement = null;
- //QName type = null;
- if (elementStack.isEmpty()) {
- schemaElement = new TopLevelElement();
- s.getSimpleTypeOrComplexTypeOrGroup().add(schemaElement);
- } else {
-
-
-// if (sameNameSpace) {
-// localElement = new LocalElement();
-// schemaElement = localElement;
-// //type = new QName(elementName);
-//
-// } else {
- schemaElement = new TopLevelElement();
- s.getSimpleTypeOrComplexTypeOrGroup().add(schemaElement);
- //type = new QName(SchemaConversionBase.SCHEMA_NS,"element");
- localElement = new LocalElement();
- localElement.setRef(new QName(parseElement.getName().getNamespaceURI(), elementName));
-
-// }
- }
- schemaElement.setName(elementName);
- elementNsMap.put(schemaElement, currentNS);
-// if (sameNameSpace) {
-// schemaElement.setType(new QName(parseElement.getName().getNamespaceURI(),elementName));
-// } else {
-// schemaElement.setType(new QName(parseElement.getName().getNamespaceURI(), elementName));
-// }
- if (!elementStack.isEmpty()) {
- ComplexType complexType = parentElement.getComplexType();
- ExplicitGroup choice = complexType.getChoice();
- if (choice == null) {
- choice = new ExplicitGroup();
- complexType.setChoice(choice);
- choice.setMaxOccurs("unbounded");
- }
- addElement(choice, new QName(SchemaConversionBase.SCHEMA_NS,"element"), localElement);
- }
-
-
- elementMap.get(s).put(elementName, schemaElement);
- newElement = true;
+ elementMap.get(s).put(elementName, schemaElement);
+ newElement = true;
+ }
+ if (parentElement != null) {
+ ComplexType complexType = getOrCreateComplexType(parentElement);
+ ExplicitGroup choice = complexType.getChoice();
+ if (choice == null) {
+ choice = new ExplicitGroup();
+ complexType.setChoice(choice);
+ choice.setMaxOccurs("unbounded");