|
Re: Mapping xmi:type to EMF type [message #422975 is a reply to message #422973] |
Fri, 19 September 2008 18:03 |
Ed Merks Messages: 33142 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
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02918 seconds