| Modifying the generated XML (model) from diagram [message #1005732] |
Mon, 28 January 2013 08:03  |
Jae Lee 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.
|
|
|