I was working adding a feature to my code generation project AjGenesis. The system manage a user-defined model, that can be loaded from .xml files. AjGenesis can process the model, completing it, invoking .NET objects, creating directories, files, and applying templates to create code and text artifacts.
But the model resides in memory: the deserialization from XML is only a choice of implementation. I’ve committed the new work in the source repository at Codeplex: now, every AjGenesis user can express his/her model in plain text
Now, a model can be expressed in simple text files. Let explore an example.
The simplest example I can imagine is a model for a Hello World application in AjGenesis. The model in XML is like:
<Project Company="ajlopez.com"> <Message>Hello, World</Message> </Project>
Now, you can express the same model in a text file:
Project Company = "ajlopez.com" Message = "Hello, World" End Project
If you need more message, you write in XML:
<Project> <Messages> <Message>Hello, World One</Message> <Message>Hello, World Two</Message> <Message>Hello, World Three</Message> </Messages> </Project>
but in text, the same model could be expressed as:
Project Messages Message = "Hello, World One" Message = "Hello, World Two" Message = "Hello, World Three" End Messages End Project
You can load the model from the console line indicating a .txt or .xml file:
..\..\..\bin\AjGenesis.Console Model.txt ModuleVb.tpl HelloWorld.vb
..\..\..\bin\AjGenesis.Console Model.xml ModuleVb.tpl HelloWorld.vb
You can explore more examples at:
In a more realistic model, you can express entities in XML:
<?xml version="1.0" encoding="utf-8" ?> <!-- An Entity with Properties --> <Entities> <Entity Name="Customer"> <Description>A Customer</Description> <Properties> <Property Name="Id" Type="Id"/> <Property Name="Name" Type="Text"/> <Property Name="Address" Type="Text"/> </Properties> </Entity> <Entity Name="Supplier"> <Description>A Supplier</Description> <Properties> <Property Name="Id" Type="Id"/> <Property Name="Name" Type="Text"/> <Property Name="Address" Type="Text"/> </Properties> </Entity> </Entities>
or from text (it’s not the same model):
Entities Entity Customer Description = "Customer Entity" Properties Property Id Type="Id" Property Name Type="Text" Property Address Type="Text" End Properties End Entity Entity Supplier Description = "Supplier Entity" Properties Property Id Type="Id" Property Name Type="Text" Property Address Type="Text" End Properties End Entity End Entities
Once the model is loaded in memory, AjGenesis process it as usual, without regarding its original form, text or XML.
More about AjGenesis:
Posts about AjGenesis (English)
Posts sobre AjGenesis (Spanish)
Loosely related, but interesting:
Problems for Textual Model Notations
Angel “Java” Lopez
http://www.ajlopez.com/en
Public Post…
Su Articulo: [678263] ha sido indexado
RSS Search Engine.
From Colombia…
Trackback by Trackback — September 29, 2008 @ 7:47 pm
[...] Textual model for code generation in AjGenesis [...]
Pingback by Another model for AjGenesis « Angel “Java” Lopez on Blog — October 2, 2008 @ 1:16 pm
[...] Modelo textual para generación de código con AjGenesisTextual model for code generation in AjGenesis [...]
Pingback by Otro modelo para AjGenesis - Angel "Java" Lopez — October 3, 2008 @ 11:07 am
[...] Modelo textual para generación de código con AjGenesisTextual model for code generation in AjGenesis [...]
Pingback by Otro modelo para AjGenesis | Buanzolandia — October 4, 2008 @ 12:01 am
[...] Modelo textual para generaci??n de c??digo con AjGenesisTextual model for code generation in AjGenesis [...]
Pingback by Otro modelo para AjGenesis | Buanzolandia — October 5, 2008 @ 8:43 am
[...] Textual model for code generation in AjGenesis [...]
Pingback by Sabattical Week Results « Angel “Java” Lopez on Blog — October 29, 2008 @ 9:48 am
[...] Textual Model for Code Generation in AjGenesis [...]
Pingback by Models for Code Generation in AjGenesis « Angel “Java” Lopez on Blog — February 27, 2010 @ 12:45 pm
[...] (note that I’m using the textual model instead the XML one, see Models for AjGenesis and Textual model for Code Generation in AjGenesis [...]
Pingback by AjGenesis and Language Workbench Competition 2011 « Angel “Java” Lopez on Blog — March 8, 2011 @ 5:34 pm
[...] para AjGenesis; Models for AjGenesis y Modelo textual para generación de código con AjGenesis; Textual model for Code Generation in AjGenesis ).Project Lwc2011 Entities Entity Person Properties Property Name Type="Text" Property [...]
Pingback by AjGenesis y Language Workbench Competition 2011 - Angel "Java" Lopez — March 11, 2011 @ 10:14 am