Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XSD2EMF mapping, map to a non-existing XSD element?
XSD2EMF mapping, map to a non-existing XSD element? [message #485403] Fri, 11 September 2009 11:53 Go to next message
Eclipse User
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 Go to previous message
Ed Merks is currently offline 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!
Previous Topic:EContentAdapter for all new Model instances
Next Topic:emfforms incubator: When should an editor be an IResourceChangeListener
Goto Forum:
  


Current Time: Sat May 25 03:50:44 EDT 2013

Powered by FUDForum. Page generated in 0.01701 seconds