Bug 337797 fix. XmlSchema resource alocation for resolve fix
diff --git a/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/command/emf/xsd/CopyTypeCommand.java b/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/command/emf/xsd/CopyTypeCommand.java
index cffd37c..aff90a5 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/command/emf/xsd/CopyTypeCommand.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/command/emf/xsd/CopyTypeCommand.java
@@ -808,13 +808,9 @@
             final EObject parent = component.eContainer();
             if (null != parent && parent instanceof XSDSchema) {
                 final String sourceTypeSchemaLocation = ((XSDSchema) parent).getSchemaLocation();
-                String schemaRelativePath = null;
-                String targetSchemaLocation = null;
+                final String targetSchemaLocation = schema.getSchemaLocation();
 
-                final IXSDModelRoot modelRoot = (IXSDModelRoot) getModelRoot();
-                targetSchemaLocation = modelRoot.getSchema().getComponent().getSchemaLocation();
-
-                schemaRelativePath = ResourceUtils.constructURI(targetSchemaLocation, sourceTypeSchemaLocation).toString();
+                String schemaRelativePath = ResourceUtils.constructURI(targetSchemaLocation,sourceTypeSchemaLocation).toString();
                 if (schemaRelativePath.length() == 0) {
                     schemaRelativePath = null;
                 }
diff --git a/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/model/utils/EmfXsdUtils.java b/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/model/utils/EmfXsdUtils.java
index c9339f0..462828e 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/model/utils/EmfXsdUtils.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/model/utils/EmfXsdUtils.java
@@ -31,6 +31,7 @@
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.resource.ResourceSet;
 import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
 import org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil;
@@ -368,8 +369,12 @@
     public static final XSDSchema resolveSchema(final java.net.URI uri) {
 
         final ResourceSet resourceSet = new ResourceSetImpl();
-        final XSDResourceImpl xsdr = (XSDResourceImpl) resourceSet.getResource(URI.createURI(uri.toString()), true);
-        return xsdr.getSchema();
+		final Resource resource = resourceSet.getResource(URI.createURI(uri.toString()), true);
+		if (resource instanceof XSDResourceImpl) {
+			final XSDResourceImpl xsdr = (XSDResourceImpl) resource;
+			return xsdr.getSchema();
+		}
+		return null;
     }
 
     /**