[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.modeling.m2m] [ATL]Load Model Problem in ATLEMFModelHandler
|
- From: xxcs214@xxxxxxx (Shan)
- Date: Mon, 12 Mar 2007 07:15:17 +0000 (UTC)
- Newsgroups: eclipse.modeling.m2m
- Organization: Eclipse
- User-agent: NewsPortal/0.36 (http://florian-amrhein.de/newsportal)
Dear All,
I try to test an example, metamodel is generated from schema using EMF
facilities
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:ns="http://www.m2matl.com/product"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.m2matl.com/product">
<element name="product" type="ns:Product" />
<complexType name="Product">
<sequence>
<element name="name" type="xsd:string" />
<element ref="ns:person" minOccurs="0" maxOccurs="1" />
</sequence>
</complexType>
<element name="person" type="ns:Person" abstract="true" />
<complexType name="Person" />
<element name="author" type="ns:Author" substitutionGroup="ns:person" />
<complexType name="Author">
<complexContent>
<extension base="ns:Person">
<sequence>
<element name="name" type="xsd:string" />
<element name="mail" type="xsd:string" />
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
transform model (product.xml) to itsslef.
<Product xmlns="http://www.m2matl.com/product"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns="http://www.m2matl.com/product">
<name>aaaa</name>
<!--<person xsi:type="Author"> -->
<person xsi:type="ns:Author">
<name>asdd</name>
<age>123</age>
</person>
</Product>
when atl engineer(AtlEMFModelHandler) load this model,throw exceptions as
below:
org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Value
'org.eclipse.emf.ecore.impl.DynamicEObjectImpl@101cb7b (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@164538f (name: Author)
(instanceClassName: null) (abstract: false, interface: false))' is not
legal. (platform:/resource/Smaple4/models/product.xml, 7, 31)
at
org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:80)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:189)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:179)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1089)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:895)
at
org.atl.engine.repositories.emf4atl.ASMEMFModel.loadASMEMFModel(ASMEMFModel.java:323)
at
org.atl.eclipse.engine.AtlEMFModelHandler.loadModel(AtlEMFModelHandler.java:122)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate.loadModel(AtlLaunchConfigurationDelegate.java:275)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate.getSourceModels(AtlLaunchConfigurationDelegate.java:333)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate.runAtlLauncher(AtlLaunchConfigurationDelegate.java:205)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate.runAtlLauncher(AtlLaunchConfigurationDelegate.java:168)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate.runAtlLauncher(AtlLaunchConfigurationDelegate.java:145)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate.runAtlLauncher(AtlLaunchConfigurationDelegate.java:121)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:97)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:639)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:565)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:754)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlugin.java:944)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Caused by: org.eclipse.emf.ecore.xmi.IllegalValueException: Value
'org.eclipse.emf.ecore.impl.DynamicEObjectImpl@101cb7b (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@164538f (name: Author)
(instanceClassName: null) (abstract: false, interface: false))' is not
legal. (platform:/resource/Smaple4/models/product.xml, 7, 31)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2382)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2367)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromTypeName(XMLHandler.java:1842)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHandler.java:1768)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1576)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:876)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:82)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:854)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:626)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:179)
.. 17 more
Caused by: java.lang.IllegalArgumentException: The feature 'person' is not
a valid changeable feature
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(BasicEObjectImpl.java:706)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:682)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:653)
at
org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.setValue(XMLHelperImpl.java:1091)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2377)
.. 35 more
I traced the problem in debug model, find that the product's metamodel is
load suceessfully, when load product.xml as a model it occurs the problem.
I ever use the schema generate product.genmodel product.ecore file ,using
EMF generate three plugin project: product,product.edit and
product.editor. The plugin works well and can create Product model
files(In this file,it doestn't container "person" element but "author"
element). But when the ecore file using in ATL,it has some problems.
Please help me,how to resolve the problem, and how to transform elements
having realtionship of "extend", can anyone give an example using
product.xml(maybe the product.xml need change) I list above tranform to
itself, any help would be appreciated very much!
Thanks in andvance!