summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-08-16 21:45:48 (EDT)
committerpelder2006-08-16 21:45:48 (EDT)
commite34a2691216d2a49f3c2b9c5af04aa249bff6c86 (patch)
treebc865997c168ebfce2a03ab0d9f1d2a861fc4180
parent7d152799d36ea95ddcfd3e89c1402c6c6cb54267 (diff)
downloadorg.eclipse.jet-e34a2691216d2a49f3c2b9c5af04aa249bff6c86.zip
org.eclipse.jet-e34a2691216d2a49f3c2b9c5af04aa249bff6c86.tar.gz
org.eclipse.jet-e34a2691216d2a49f3c2b9c5af04aa249bff6c86.tar.bz2
[154157] Handle shallow copying of XML elements with Any and AnyAttribute wildcard features.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java16
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/EObjectInspectorTests.java1
2 files changed, 16 insertions, 1 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java
index 9c7eb39..d446853 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java
@@ -983,7 +983,21 @@ public class EObjectInspector implements IElementInspector, INodeInspectorExtens
else
{
EcoreUtil.Copier copier = new ShallowCopier();
- newElement = copier.copy(srcEObject);
+ EObject newEObject = copier.copy(srcEObject);
+ copier.copyReferences();
+ final EClass eClass = newEObject.eClass();
+ if(isXMLNode(eClass)) {
+ // copyReferences will have copied mixed and any features, if present
+ // we need to remove these...
+ final EAttribute mixedFeature = extendedMetaData.getMixedFeature(eClass);
+ if(mixedFeature != null)
+ {
+ FeatureMap fm = (FeatureMap)newEObject.eGet(mixedFeature);
+ fm.clear();
+ }
+ }
+
+ newElement = newEObject;
}
addElementToParent(eObject, feature, newElement, null);
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/EObjectInspectorTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/EObjectInspectorTests.java
index de95b7e..699cd44 100644
--- a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/EObjectInspectorTests.java
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/EObjectInspectorTests.java
@@ -830,6 +830,7 @@ public class EObjectInspectorTests extends TestCase {
// assertEquals(elementACopy ,xmlRootElement.getAny().getValue(initialSize));
assertEquals(elementACopy ,Bug130552Workaround.getValue(xmlRootElement.getAny(), initialSize));
assertEquals(0, inspector.getChildren(elementACopy).length);
+ assertEquals(elementA.getAnyAttribute().size(), ((AnyType)elementACopy).getAnyAttribute().size());
}
public void testCopyElement_xsd() throws CopyElementException {