| [news.eclipse.tools.emf] Re: XSD2EMF mapping, map to a non-existing XSD element? |
David,
Comments below.
There's no way to inject new features that aren't in the XSD.for example, I defined a complex type in XSD and added a mapping
<complexType name="transition">
<complexContent>
<extension base="gd:graph_element">
<attribute name="to" type="IDREF" ecore:reference="gd:node"></attribute>
</extension>
</complexContent>
</complexType>
Now I want to add a new attribute 'from' for EMF Class Transition, that is this attribute doesn't exist in XSD definition.
In further, I want an Addon not a xsd2emf mapping. If a XML snippet like below, it's illegal.You need to add a real xsd attribute, at least for the purpose of creating the Ecore model. Is the "from" derived somehow, i.e, by the node that contains the transition? In that case you can put an ecore:opposite annotation on the containment reference to create a container reference that's the opposite of the containment...
<transition from="xxx" to="yyy"/>.
The only acceptable format is <transition to="yyy"/>
I tried like below, but it doesn't be recognized by XSDGenmodel.
<complexType name="transition">
<complexContent>
<extension base="gd:graph_element">
<attribute name="to" type="IDREF" ecore:reference="gd:node"></attribute>
<ecore:attribute name="from" type="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
</extension> </complexContent> </complexType>
Thanks for your help!