How to add get a GUID attribute when reading a XMI file [message #698122] |
Mon, 18 July 2011 16:06  |
Eclipse User |
|
|
|
Hi,
I was hoping someone out there could help me out with this issue of mine. My ultimate goal is to interpret and traverse this .xmi file through Eclipse to create appropriate diagrams from it. However, to do so I must have access to the GUIDs from the .xmi with a relationship to the interpreted EObjects; Does anyone have any ideas on how to make this work? (It would be amazing if I can somehow have Eclipse add an attribute say .GUID to provide me with this piece of information) Here is the code I used to have Eclipse interpret the .xmi for me.
ResourceSet RS = new ResourceSetImpl();
RS.getLoadOptions().put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE,Boolean.TRUE);
org.eclipse.emf.ecore.xmi.XMLResource resource = (XMLResource) RS.getResource(fileURI, true);
So from here resource has everything I need so far EXCEPT the GUID relationship of each object.
Any form of assistance would be much appreciated.
Thanks.
Benson
|
|
|
Re: How to add get a GUID attribute when reading a XMI file [message #698150 is a reply to message #698122] |
Mon, 18 July 2011 17:25   |
Eclipse User |
|
|
|
Benson,
Comments below.
On 18/07/2011 1:06 PM, Benson wrote:
> Hi,
>
> I was hoping someone out there could help me out with this issue of
> mine. My ultimate goal is to interpret and traverse this .xmi file
> through Eclipse to create appropriate diagrams from it. However, to
> do so I must have access to the GUIDs from the .xmi with a
> relationship to the interpreted EObjects;
Generally everything to do with IDs, e.g., resolving them, is handled
for you without you ever having to manipulate a GUID...
> Does anyone have any ideas on how to make this work? (It would be
> amazing if I can somehow have Eclipse add an attribute say .GUID to
> provide me with this piece of information) Here is the code I used to
> have Eclipse interpret the .xmi for me.
>
> ResourceSet RS = new ResourceSetImpl();
> RS.getLoadOptions().put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE,Boolean.TRUE);
>
> org.eclipse.emf.ecore.xmi.XMLResource resource = (XMLResource)
> RS.getResource(fileURI, true);
You can use resource.getID(EObject) to get the extrinsic ID associated
with that object.
>
> So from here resource has everything I need so far EXCEPT the GUID
> relationship of each object.
>
> Any form of assistance would be much appreciated.
> Thanks.
> Benson
|
|
|
|
Powered by
FUDForum. Page generated in 0.03315 seconds