Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320662

Summary: attribute of type Name results in compilation Error for Generated code.
Product: [Modeling] EEF Reporter: Christophe Bouhier <dzonekl>
Component: GeneralAssignee: EEF Inbox <emft.eef-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: sbouchet, stephane.begaudeau
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Christophe Bouhier CLA 2010-07-22 16:05:52 EDT
1. Create a .XSD model with 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns="http://www.netxforge.com/eef_bug"
	xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:xs="http://www.w3.org/2001/XMLSchema"
	id="eef_bug" targetNamespace="http://www.netxforge.com/eef_bug">

	<xs:complexType name="Country">
		<xs:attribute name="Name" type="xs:Name" ecore:id="true"/>
	</xs:complexType>

</xs:schema>


2. create .genmodel from the .xsd
3. create .eefgen from the .genmodel
4. create the source code and observe a compilation error.
Comment 1 Bouchet Stéphane CLA 2010-07-23 04:13:25 EDT
Added omments from Ed that inline the correct way to generates : 

> Note that when a Literals interface is generated, 
> NetworksPackage.Literals.COUNTRY__NAME == msg.getFeature() would be more 
> efficient.
>> if (msg.getNewValue() != null) {
>> basePart.setName(EcoreUtil.convertToString(XMLTypePackage.eINSTANCE.getName(), 
>> msg.getNewValue()));
> Similarly NetworksPackage.Literals.NAME could be generated. In any case, 
> genFeature.getFeatureAccessorName() should be used in the template so 
> that getName_ will be call. Note that getName will return the name of 
> the package.
Comment 2 Bouchet Stéphane CLA 2010-07-23 04:27:15 EDT
(In reply to comment #0)
> 1. Create a .XSD model with 
> 
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <xs:schema xmlns="http://www.netxforge.com/eef_bug"
>     xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
>     id="eef_bug" targetNamespace="http://www.netxforge.com/eef_bug">
> 
>     <xs:complexType name="Country">
>         <xs:attribute name="Name" type="xs:Name" ecore:id="true"/>
>     </xs:complexType>
> 
> </xs:schema>
> 
> 
> 2. create .genmodel from the .xsd
> 3. create .eefgen from the .genmodel
> 4. create the source code and observe a compilation error.

to be honest, EEF has not been heavily tested on XSD, but it will be now with your testcase :)
Comment 3 Stephane Begaudeau CLA 2016-05-30 10:07:41 EDT
The Eclipse EEF team has worked over the past few months on a brand new runtime using a reflective approach which can be used more easily with Eclipse Sirius. Since we do not plan to continue to work on the old runtime and its code generation approach, I will close this issue for now.

If you want to contribute, you can reopen this issue and submit a contribution to the project thanks to our Gerrit: https://git.eclipse.org/r/#/admin/projects/eef/org.eclipse.eef