|Acessing elements from a list [message #46022]
||Wed, 21 May 2008 14:04
Originally posted by: wickers.jonathan.gmail.com|
I created a meta model extending ecore to add attributes to eClass. One
of my attribute is a list extending eStructuralFeature.
I created my plugin using EMF, and it worked well, and then, created my
My problem is how to get my datas in the list ? How can I iterate on
this list ?
I tried this, but without any succes :
<c:iterate select "$currentClass/MappedAttribute" var=currentElem">
<c:get select "$currentElem/@hashcodeList" />
Thanks for help
|Re: Acessing elements from a list [message #46625 is a reply to message #46343]
||Thu, 29 May 2008 17:24
| Paul Elder
Registered: July 2009
I'm glad I misunderstood. This is definitely easier...
Let's assume $myEClass points to your MyEClass instance your described here:
> <eClassifiers xsi:type="MyEClass" name="Capability"
> dbTableName="capability" equalsAttributesList="//Capability/id
So, $myEClass/@name would return 'Capability' and $myEClass/@dbTableName
would return 'capability'
But, equalsAttributeList is a manifestation of an EReference, so
$myEClass/@equalsAttributesList WOULD NOT return anything.
Instead, the list is referenced as if 'equalsAttributesList' were XML child
elements $myEClass/equalsAttributesList, with each element being an entry in
the list. Typically, you'd write JET code like this:
<c:iterate select="$myEClass/equalsAttributesList" var="ea">
<%-- do something with $ea --%>
This is a case were looking at the XMI saved by EMF can be misleading. JET
is not reading the XMI! It is looking at in-memory EObjects and their
corresponding EClass's. If a feature of the EObject is delcared as an
EAttribute, you access it with @. If it is an EReference, you access it like
Hope this helps.
And, your English is excellent :-)
Powered by FUDForum
. Page generated in 0.04177 seconds