Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
Refactored code.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.wso2.org/repos/wso2/trunk/wsf@67627 a5903396-d722-0410-b921-86c7d4935375
  • Loading branch information
heshan committed Jun 5, 2010
1 parent 53eb545 commit e77ce23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.ws.commons.schema.utils.NamespaceMap;

import javax.xml.namespace.QName;
import java.util.Iterator;

/**
* Schema generation class.
Expand All @@ -47,8 +46,6 @@ public class SchemaGenerator {

private TypeTable typeTable;

private String DEFAULT_SCHEMA_NAMESPACE_PREFIX = "xs";
private String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
private String RESPONSE = "Response";

public NamespaceMap getNamespaceMap() {
Expand All @@ -65,8 +62,9 @@ public SchemaGenerator(String schemaTargetNamespace, TypeTable typeTable) {
xmlSchema.setAttributeFormDefault(new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED));
xmlSchema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED));

nameSpacesMap.put(DEFAULT_SCHEMA_NAMESPACE_PREFIX,
URI_2001_SCHEMA_XSD);
String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
String DEFAULT_SCHEMA_NAMESPACE_PREFIX = "xs";
nameSpacesMap.put(DEFAULT_SCHEMA_NAMESPACE_PREFIX, URI_2001_SCHEMA_XSD);
nameSpacesMap.put(prefix, this.schemaTargetNamespace);
xmlSchema.setNamespaceContext(nameSpacesMap);
}
Expand Down Expand Up @@ -129,17 +127,15 @@ private XmlSchemaComplexType createComplexType(ComplexType complexType, String e
xmlSchema.getItems().add(xmlSchemaComplexType);

XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence();
Iterator<Type> iterator = complexType.getMembers().iterator();
while (iterator.hasNext()) {
Object object = iterator.next();
for (Type type : complexType.getMembers()) {
XmlSchemaElement xmlSchemaElement;
if (object instanceof SimpleType) {
SimpleType simpleType = (SimpleType) object;
if (type instanceof SimpleType) {
SimpleType simpleType = (SimpleType) type;
if ((xmlSchemaElement = createXMLSchemaElement(simpleType.getName(), simpleType.getType())) != null) {
xmlSchemaSequence.getItems().add(xmlSchemaElement);
}
} else if (object instanceof ComplexType) {
ComplexType complexTypeParam = (ComplexType) object;
} else if (type instanceof ComplexType) {
ComplexType complexTypeParam = (ComplexType) type;
if ((xmlSchemaElement = handleComplexType(complexTypeParam, elementName +
complexTypeParam.getName() + TYPE)) != null) {
xmlSchemaElement.setName(complexTypeParam.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
import javax.xml.namespace.QName;
import java.util.HashMap;

public abstract class
TypeTable {
public abstract class TypeTable {

protected HashMap simpleTypetoxsd;
protected HashMap complexTypeMap;
Expand Down

0 comments on commit e77ce23

Please sign in to comment.