Code Generation: How to integrate multiple generators?

Hi,

I try to generate C# code as well as XML code from one model. For this purpose I created two generator models in the generator aspect of my language. When testing the generator it creates both a .cs and a .xml file. But the problem is that both files contain parts from the generation result of the other generator, i.e. the .cs file contains XML elements and the .xml file contains C# classes.

It would be great if you could give me a hint how to solve this issue.

Thank you very much in advance,
LaAck
0
2 comments
Avatar
Permanently deleted user
Maybe you mixed the reduction rules accidentally? If you start with e.g. an XML root and reduce nodes to C#, this may happen.

Best regards,
jens
0
Avatar
Permanently deleted user
Hi Jens,

thank you for your reply. I checked it but did not find any misplaced reduction rule. I defined two mapping configurations, one in each generator model. Both start with the correct root node and reduce remaining nodes only to element instances of the same language.

Ah, cool. Directly when writing this reply I had an idea. You may define generator priorities in the module properties. By default both generator mappings seem to be executed simultaneously. I provided an order and now it works. :)
0

Please sign in to leave a comment.