| XSD2EMF mapping, map to a non-existing XSD element? [message #485403] |
Fri, 11 September 2009 11:53  |
|
Originally posted by: lifesting.gmail.com
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.
<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!
|
|
|
| Re: XSD2EMF mapping, map to a non-existing XSD element? [message #485413 is a reply to message #485403] |
Fri, 11 September 2009 12:22  |
Ed Merks Messages: 24562 Registered: July 2009 |
Senior Member |
|
|
David,
Comments below.
david by chan wrote:
> 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.
There's no way to inject new features that aren't in the XSD.
> In further, I want an Addon not a xsd2emf mapping. If a XML snippet
> like below, it's illegal.
>
> <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"/>
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...
> </extension>
> </complexContent>
> </complexType>
>
>
> Thanks for your help!
|
|
|
Powered by
FUDForum. Page generated in 0.01701 seconds