Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Modifying the generated XML (model) from diagram
Modifying the generated XML (model) from diagram [message #1005732] Mon, 28 January 2013 13:03 Go to next message
Jae Lee is currently offline Jae LeeFriend
Messages: 4
Registered: January 2013
Junior Member
Hi, I previously uploaded this question to GMF forum but one person suggested that it might be better to question my question on this forum so I have going to reiterate the thing that I wanted to ask.

Basically, I want to modify the XML file generated from my diagram (graphical editor generated by GMF) So basically, when I want to refer to some part of the element, it seems that the EMF automatically creates a random serial number for each element. Take a look at this example:

<?xml version="1.0" encoding="UTF-8"?>
<caparch:ComponentDiagram xmlns:caparch="caparch">
<componentType ID="" name="DriveControllerType">
<interfaceInstances interfaceTypeLink="#//@interfaceType.0" interfaceRoleLink="#//@interfaceType.0/@interfaceRoles.0"/>
</componentType>
<connectorType>
<interfaceInstances interfaceTypeLink="#//@interfaceType.1" interfaceRoleLink="#//@interfaceType.1/@interfaceRoles.0"/>
</connectorType>
<componentInstance ID="IBTTYPE" name="DriveControllerInstance" componentTypeLink="#//@componentType.0">
<interfaceInstanceLinks interfaceInstanceLinking="#//@componentType.0/@interfaceInstances.0"/>
</componentInstance>
<connectorInstance connectorTypeLink="#//@connectorType.0">
<interfaceInstanceLinks interfaceInstanceLinking="#//@connectorType.0/@interfaceInstances.0"/>
</connectorInstance>
<domain name="DCritical" desc="The domain containing the critical components" componentInstanceLinking="#//@componentInstance.0" connectorInstanceLinking="#//@connectorInstance.0"/>
<link connector="#//@connectorInstance.0/@interfaceInstanceLinks.0" component="#//@componentInstance.0/@interfaceInstanceLinks.0"/>
</caparch:ComponentDiagram>

From this XML, let's get the domain part:

<domain name="DCritical" desc="The domain containing the critical components" componentInstanceLinking="#//@componentInstance.0" connectorInstanceLinking="#//@connectorInstance.0"/>

IT seems that it refers to other element by saying "#//@componentInstance.0" However, I want my domain to refer to the ID attribute of the element for example #//@componentInstance.IBTTYPE if that componentInstance's ID is IBTTYPE, which would look like:

<componentInstance ID="IBTTYPE" ..... bla bla bla

can I do this?

one person answered : "You can have a custom serialization of EMF models thats for sure." how do I do this?

Thank you very much for sharing your knowledge!

It would be good if the answer is thorough enough for me follow the answer easily.

Re: Modifying the generated XML (model) from diagram [message #1005739 is a reply to message #1005732] Mon, 28 January 2013 13:33 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Jae,

I answer this already. I.e., I asked is the ID EAttribute marked with
isID true in the Ecore model? If you do that, it should be used for the
serialized reference. Also, if your references can't ever be cross
document and you don't want the "#" in the reference, you should mark
that EReference with isResolveProxies false.


On 28/01/2013 2:03 PM, Jae Lee wrote:
> Hi, I previously uploaded this question to GMF forum but one person
> suggested that it might be better to question my question on this
> forum so I have going to reiterate the thing that I wanted to ask.
>
> Basically, I want to modify the XML file generated from my diagram
> (graphical editor generated by GMF) So basically, when I want to refer
> to some part of the element, it seems that the EMF automatically
> creates a random serial number for each element. Take a look at this
> example:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <caparch:ComponentDiagram xmlns:caparch="caparch">
> <componentType ID="" name="DriveControllerType">
> <interfaceInstances interfaceTypeLink="#//@interfaceType.0"
> interfaceRoleLink="#//@interfaceType.0/@interfaceRoles.0"/>
> </componentType>
> <connectorType>
> <interfaceInstances interfaceTypeLink="#//@interfaceType.1"
> interfaceRoleLink="#//@interfaceType.1/@interfaceRoles.0"/>
> </connectorType>
> <componentInstance ID="IBTTYPE" name="DriveControllerInstance"
> componentTypeLink="#//@componentType.0">
> <interfaceInstanceLinks
> interfaceInstanceLinking="#//@componentType.0/@interfaceInstances.0"/>
> </componentInstance>
> <connectorInstance connectorTypeLink="#//@connectorType.0">
> <interfaceInstanceLinks
> interfaceInstanceLinking="#//@connectorType.0/@interfaceInstances.0"/>
> </connectorInstance>
> <domain name="DCritical" desc="The domain containing the critical
> components" componentInstanceLinking="#//@componentInstance.0"
> connectorInstanceLinking="#//@connectorInstance.0"/>
> <link connector="#//@connectorInstance.0/@interfaceInstanceLinks.0"
> component="#//@componentInstance.0/@interfaceInstanceLinks.0"/>
> </caparch:ComponentDiagram>
>
> From this XML, let's get the domain part:
>
> <domain name="DCritical" desc="The domain containing the critical
> components" componentInstanceLinking="#//@componentInstance.0"
> connectorInstanceLinking="#//@connectorInstance.0"/>
>
> IT seems that it refers to other element by saying
> "#//@componentInstance.0" However, I want my domain to refer to the ID
> attribute of the element for example #//@componentInstance.IBTTYPE if
> that componentInstance's ID is IBTTYPE, which would look like:
>
> <componentInstance ID="IBTTYPE" ..... bla bla bla
>
> can I do this?
>
> one person answered : "You can have a custom serialization of EMF
> models thats for sure." how do I do this?
>
> Thank you very much for sharing your knowledge!
>
> It would be good if the answer is thorough enough for me follow the
> answer easily.
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] Unmonitored fail-over example
Next Topic:Create proxy object for abstract reference type
Goto Forum:
  


Current Time: Thu Mar 28 22:38:13 GMT 2024

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

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

Back to the top