Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Get the markup name associated with an EObject
Get the markup name associated with an EObject [message #427771] Mon, 02 March 2009 11:31 Go to next message
Vincent Zurczak is currently offline Vincent ZurczakFriend
Messages: 149
Registered: July 2009
Senior Member

Hi.

I have an EMF model, created from XSD files.
What I'd like to do is to be able to retrieve the mark-up name
associated with a given EObject (when it can be serialized as an XML
element).

Notice that I don't want to serialize anything when I do that.
I just want the mark-up name, with no namespace prefix or anything.

I have seen in the ecore that this information is hold by extended meta
data (in the root eStructuralFeatures). I tried to get it from one of my
EObjects, but I didn't get the right meta data.

I also checked the XMLSaveImpl and XMLHelperImpl, but I got lost.
Is there any way to retrieve this information from an EObject?


Regards,

Vincent Zurczak.


--
Vincent Zurczak
EBM WebSourcing
+33 (0) 4 38 12 16 77
Re: Get the markup name associated with an EObject [message #427821 is a reply to message #427771] Mon, 02 March 2009 12:53 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000004070405040305070505
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Vincent,

Comments below.


Vincent Zurczak wrote:
> Hi.
>
> I have an EMF model, created from XSD files.
> What I'd like to do is to be able to retrieve the mark-up name
> associated with a given EObject (when it can be serialized as an XML
> element).
>
> Notice that I don't want to serialize anything when I do that.
> I just want the mark-up name, with no namespace prefix or anything.
>
> I have seen in the ecore that this information is hold by extended
> meta data (in the root eStructuralFeatures). I tried to get it from
> one of my EObjects, but I didn't get the right meta data.
>
> I also checked the XMLSaveImpl and XMLHelperImpl, but I got lost.
> Is there any way to retrieve this information from an EObject?
Generally an EObject, when serialized, will use the name and namespace
of the containing object's feature. I.e.,

ExtendedMetaData.INSTANCE.getName(eObject.eContainmentFeatur e())
ExtendedMetaData.INSTANCE.getNamespace(eObject.eContainmentF eature())

If the object's type is different from the feature's type, an xsi:type
will be serialized too

ExtendedMetaData.INSTANCE.getName(eObject.eClass())
ExtendedMetaData.INSTANCE.getNamespace(eObject.eClass())

>
>
> Regards,
>
> Vincent Zurczak.
>
>

--------------000004070405040305070505
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Vincent,<br>
<br>
Comments below.<br>
<br>
<br>
Vincent Zurczak wrote:
<blockquote cite="mid:gogg3b$r89$1@build.eclipse.org" type="cite">Hi.
<br>
<br>
I have an EMF model, created from XSD files.
<br>
What I'd like to do is to be able to retrieve the mark-up name
associated with a given EObject (when it can be serialized as an XML
element).
<br>
<br>
Notice that I don't want to serialize anything when I do that.
<br>
I just want the mark-up name, with no namespace prefix or anything.
<br>
<br>
I have seen in the ecore that this information is hold by extended meta
data (in the root eStructuralFeatures). I tried to get it from one of
my EObjects, but I didn't get the right meta data.
<br>
<br>
I also checked the XMLSaveImpl and XMLHelperImpl, but I got lost.
<br>
Is there any way to retrieve this information from an EObject?
<br>
</blockquote>
Generally an EObject, when serialized, will use the name and namespace
of the containing object's feature.&nbsp; I.e.,<br>
<blockquote>&nbsp;
ExtendedMetaData.INSTANCE.getName(eObject.eContainmentFeatur e()) <br>
&nbsp; ExtendedMetaData.INSTANCE.getNamespace(eObject.eContainmentF eature()) <br>
</blockquote>
If the object's type is different from the feature's type, an xsi:type
will be serialized too<br>
<blockquote>&nbsp; ExtendedMetaData.INSTANCE.getName(eObject.eClass())<br>
&nbsp; ExtendedMetaData.INSTANCE.getNamespace(eObject.eClass())<br >
</blockquote>
<blockquote cite="mid:gogg3b$r89$1@build.eclipse.org" type="cite"><br>
<br>
Regards,
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Vincent Zurczak.
<br>
<br>
<br>
</blockquote>
</body>
</html>

--------------000004070405040305070505--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Get the markup name associated with an EObject [message #427822 is a reply to message #427821] Mon, 02 March 2009 13:19 Go to previous message
Vincent Zurczak is currently offline Vincent ZurczakFriend
Messages: 149
Registered: July 2009
Senior Member

Great!
Thanks for your help,


Vincent




Ed Merks a écrit :
> Vincent,
>
> Comments below.
>
>
> Vincent Zurczak wrote:
>> Hi.
>>
>> I have an EMF model, created from XSD files.
>> What I'd like to do is to be able to retrieve the mark-up name
>> associated with a given EObject (when it can be serialized as an XML
>> element).
>>
>> Notice that I don't want to serialize anything when I do that.
>> I just want the mark-up name, with no namespace prefix or anything.
>>
>> I have seen in the ecore that this information is hold by extended
>> meta data (in the root eStructuralFeatures). I tried to get it from
>> one of my EObjects, but I didn't get the right meta data.
>>
>> I also checked the XMLSaveImpl and XMLHelperImpl, but I got lost.
>> Is there any way to retrieve this information from an EObject?
> Generally an EObject, when serialized, will use the name and namespace
> of the containing object's feature. I.e.,
>
> ExtendedMetaData.INSTANCE.getName(eObject.eContainmentFeatur e())
> ExtendedMetaData.INSTANCE.getNamespace(eObject.eContainmentF eature())
>
> If the object's type is different from the feature's type, an xsi:type
> will be serialized too
>
> ExtendedMetaData.INSTANCE.getName(eObject.eClass())
> ExtendedMetaData.INSTANCE.getNamespace(eObject.eClass())
>
>>
>>
>> Regards,
>>
>> Vincent Zurczak.
>>
>>


--
Vincent Zurczak
EBM WebSourcing
+33 (0) 4 38 12 16 77
Previous Topic:Suppresing model objects
Next Topic:"Resolve Proxies" property
Goto Forum:
  


Current Time: Thu Apr 25 16:36:27 GMT 2024

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

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

Back to the top