|XSD 2 Ecore with Xpand [message #1005918]
||Tue, 29 January 2013 10:02
| serhat gezgin
Registered: January 2013
I want to use xpand for xsd 2 ecore.
But i have problem because my xsd metamodel is larger meaning of ecore.
Ecore dont support inner class system. But my XSD metamodel have inner
class hierarchy. Because of these i must convert inner class to 2 different classes.
Problem is start here. When i see inner class i must write
this class out of its parent and must be reference to its parent. So i have list of
inner classes and later when parent class text finished i must implement these
clases. But this approach is complex. Question is;
How can i use ecore api or something to create ecore simple ?
Not: I dont want to create .ecore file with text(xml)value i just need to use library or somethink else to create ecore can u help me with this ?
my template sample;
«DEFINE Root FOR ir::IModule»
«FILE moduleName(name) + ".ecore"»<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name= "«moduleName(name)»" nsURI="http://«moduleName(name)»/1.0" nsPrefix="«moduleName(name)»">
«EXPAND EClass FOREACH clafers()»
[Updated on: Tue, 29 January 2013 11:29]
Report message to a moderator
|Re: XSD 2 Ecore with Xpand [message #1006398 is a reply to message #1005918]
||Thu, 31 January 2013 09:08
|| Karsten Thoms
Registered: July 2009
Location: Dortmund, Germany
I don't really understand what you wrote, sorry.
Your task is to map an XSD to Ecore, right? For this task you would not need Xpand, there is a standard mapping implementation in EMF XSD, see class org.eclipse.xsd.ecore.XSDEcoreBuilder.XSDEcoreBuilder.
Xpand's XSD typesystem uses this class to derive types from XSD, it might be worth at the sources in the plugin org.eclipse.xtend.typesystem.xsd, especially class OawXSDEcoreBuilder, XSDMetaModel.
Note also this blog entry: http://www.svenlange.co.za/2013/01/avoid-name-collision-in-ecore-generated-from-xsd/
Hope this helps,
Powered by FUDForum
. Page generated in 0.02558 seconds