Skip to main content



      Home
Home » Modeling » EMF » [EMF] Get element name of an EObject
[EMF] Get element name of an EObject [message #1058252] Mon, 13 May 2013 07:12 Go to next message
Eclipse UserFriend
Hi,

Is there a possibility to get the XML element name of an EObject.
I used eObject.eClass().getName(). But in cases where xml structure is with xsi types, it gives the specific type instead of the generic element.

Eg: I have an xml tag <GENERIC attr1="String" xsi:type="SPECIFIC"/>

When i do eObject.eClass().getName() I get SPECIFIC. However i need GENERIC as the value.

Thanks.
Regards,
Dhanya
Re: [EMF] Get element name of an EObject [message #1058300 is a reply to message #1058252] Mon, 13 May 2013 09:48 Go to previous messageGo to next message
Eclipse UserFriend
Try eObject.eContainingFeature().getName().

The XML tag name does not correspond to a type name but to the name of the (containment) feature through which the parent element/object contains this one.
Re: [EMF] Get element name of an EObject [message #1058335 is a reply to message #1058300] Mon, 13 May 2013 11:07 Go to previous messageGo to next message
Eclipse UserFriend
Yes, or more generally, to get the actual XML name if there is extended
metadata, and to deal with features in feature maps, you'd to use
ExtendedMetaData.INSTANCE.getName(eObject.eContainmentFeature()).


On 13/05/2013 3:48 PM, Pierre-Charles David wrote:
> Try eObject.eContainingFeature().getName().
>
> The XML tag name does not correspond to a type name but to the name of
> the (containment) feature through which the parent element/object
> contains this one.
>
Re: [EMF] Get element name of an EObject [message #1058418 is a reply to message #1058335] Tue, 14 May 2013 00:46 Go to previous message
Eclipse UserFriend
Thanks.

eObject.eContainingFeature().getName() gives me the type name. In the eg: gENERIC
and
ExtendedMetaData.INSTANCE.getName(eObject.eContainmentFeature()) gives me the XML tag name GENERIC
Previous Topic:Compare 2 EObjects with that same model
Next Topic:[POLL] Still Using Java 1.5?
Goto Forum:
  


Current Time: Sun Jul 27 04:33:19 EDT 2025

Powered by FUDForum. Page generated in 0.29236 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top