Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Mapping xmi:type to EMF type
Mapping xmi:type to EMF type [message #422973] Fri, 19 September 2008 17:56 Go to next message
Benoit Beaudet is currently offline Benoit BeaudetFriend
Messages: 7
Registered: July 2009
Junior Member
Hi,

I want to know if it exists a way to map a an XML to EMF type ?

<vertices xmi:type="bpmn:Activity" xmi:id="_Gs5RMX9GEd2StNMWrsqzRQ"
iD="_Gs5RMH9GEd2StNMWrsqzRQ" outgoingEdges="_4fivwX9HEd2StNMWrsqzRQ
_-c3CwX9HEd2StNMWrsqzRQ" incomingEdges="_1ZgL4X9HEd2StNMWrsqzRQ"
name="Assurance qualité?" activityType="GatewayDataBasedExclusive"/>

I want to avoid this kind of code:

if (bpmnType.equals("bpmn:SequenceEdge"))
{
image =
BpmnPaletteFactory.findSmallImgDescr(BpmnPaletteFactory.FLOW _CONNECTOR).createImage();
}


Thanks
Re: Mapping xmi:type to EMF type [message #422975 is a reply to message #422973] Fri, 19 September 2008 18:03 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30803
Registered: July 2009
Senior Member
Benoit,

Comments below.

Benoit Beaudet wrote:
> Hi,
>
> I want to know if it exists a way to map a an XML to EMF type ?
>
> <vertices xmi:type="bpmn:Activity" xmi:id="_Gs5RMX9GEd2StNMWrsqzRQ"
> iD="_Gs5RMH9GEd2StNMWrsqzRQ" outgoingEdges="_4fivwX9HEd2StNMWrsqzRQ
> _-c3CwX9HEd2StNMWrsqzRQ" incomingEdges="_1ZgL4X9HEd2StNMWrsqzRQ"
> name="Assurance qualité?" activityType="GatewayDataBasedExclusive"/>
>
> I want to avoid this kind of code:
>
> if (bpmnType.equals("bpmn:SequenceEdge"))
> {
> image =
> BpmnPaletteFactory.findSmallImgDescr(BpmnPaletteFactory.FLOW _CONNECTOR).createImage();
>
> }
The deserializer handles this automatically. The way the process works
is that the prefix is resolved to the xmlns declaration that must exist,
i.e, there must be an xmlns:bpmn="<namespace>" in the context. From
this we use EPackage.Registry.INSTANCE.get(<namespace>) to get the
EPackage, and from that we use EPackage.getEClassifier(<name>) to find
the EClassifier, which in this case would be an EClass. Then we can use
ePackage.getEInstanceFactory().create(eClass) to create the instance.
>
>
> Thanks
>
Previous Topic:CDO: Problem with dynamic model
Next Topic:[CDO] best practice for 'getting' a resource
Goto Forum:
  


Current Time: Sun Jan 19 04:22:38 GMT 2020

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

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

Back to the top