[370771] Feature redundant only if in hierarchy
diff --git a/plugins/org.eclipse.xsd/src/org/eclipse/xsd/ecore/XSDEcoreBuilder.java b/plugins/org.eclipse.xsd/src/org/eclipse/xsd/ecore/XSDEcoreBuilder.java
index a6a5d33..a904176 100644
--- a/plugins/org.eclipse.xsd/src/org/eclipse/xsd/ecore/XSDEcoreBuilder.java
+++ b/plugins/org.eclipse.xsd/src/org/eclipse/xsd/ecore/XSDEcoreBuilder.java
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2002-2006 IBM Corporation and others.
+ * Copyright (c) 2002-2012 IBM Corporation and others.
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -1131,9 +1131,8 @@
             boolean isRedundant = false;
             if (isRestriction)
             {
-              isRedundant =
-                extendedMetaData.getElement
-                  (baseClass, xsdElementDeclaration.getTargetNamespace(), xsdElementDeclaration.getName()) != null;
+              EStructuralFeature element = extendedMetaData.getElement(baseClass, xsdElementDeclaration.getTargetNamespace(), xsdElementDeclaration.getName());
+              isRedundant = element != null && !extendedMetaData.isDocumentRoot(element.getEContainingClass());
 
               if (!isRedundant)
               {