{
documentRoot = (EObject)resource.getContents().get(0);
EClass documentRootClass = documentRoot.eClass();
if ("".equals(extendedMetaData.getName(documentRootClass))) //TODO efficient way to check this? Maybe DataObject.getContainer should also check this?
{
FeatureMap featureMap = (FeatureMap)documentRoot.eGet(documentRootClass.getEStructuralFeature(0)); // get mixed feature
int size = featureMap.size();
for (int index = 0; index < size; index++)
{
EStructuralFeature feature = featureMap.getEStructuralFeature(index);
boolean isText =
feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT ||
feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA ||
feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT;
if (!isText)
{
if (feature instanceof EReference)
{
rootObject = (EObject)featureMap.getValue(index);
documentRoot.eUnset(feature);
}
else //EAttribute
{
rootObject = (EObject)SDOUtil.createDataTypeWrapper((Type)feature.getEType(), featureMap.getValue(index));
}
rootElement = feature;
break;
}
} //for