|
![]() |
The <Gen-it> Manual |
|
2. How do I get a XML file describing my database?Now we've seen the <Gen-it> process in a simple example, it's time to provide some more detail for each of the steps. We'll start with the process of getting the XML file describing your database or classes, but first we need to say al little bit more about the format of this XML file. To generate code you can use different kinds of XML formats, but when you create a XSL template you have to create it specifically for this kind of XML format. For this reason all XSL templates on this site are based on a "standard" XML format: the <Gen-it> XML Format. We will refer to this format as GXF from now on. GXF files look something like this: <Gen-it>
<Class>
<Class.name>Orderline</Class.name>
<Class.stereotype></Class.stereotype>
<Class.documentation>Orderlines of a order.</Class.documentation>
<Attribute>
<Attribute.name>orderlineid</Attribute.name>
<Attribute.datatype>NUMERIC(10,0)</Attribute.datatype>
<Attribute.stereotype>PK</Attribute.stereotype>
<Attribute.documentation>Unique identifier, not visible for users.</Attribute.documentation>
</Attribute>
<Attribute>
<Attribute.name>amount</Attribute.name>
<Attribute.datatype>NUMERIC(5,0)</Attribute.datatype>
<Attribute.stereotype>NOT NULL</Attribute.stereotype>
<Attribute.documentation> </Attribute.documentation>
</Attribute>
<Attribute>
<Attribute.name>productid</Attribute.name>
<Attribute.datatype>NUMERIC(10,0)</Attribute.datatype>
<Attribute.stereotype>FK</Attribute.stereotype>
<Attribute.documentation/>
<Reference>
<Reference.name>productid</Reference.name>
<Reference.documentation/>
<Reference.class>Product</Reference.class>
<Reference.mulitplicity>1..1</Reference.mulitplicity>
<Reference.optional>False</Reference.optional>
<Reference.attribute>productid</Reference.attribute>
</Reference>
</Attribute>
</Class>
</Gen-it>
You can see it's a bit more elaborate then the one used in our previous
example. Most of the format is pretty straightforward, but some tags
need a bit more explaining: OK, now you know how a GXF file looks like, but "How do I get
a XML file describing my database?" Well, there are three ways: Write your own GXF file Use XMI Use the <Gen-it> Transformation Manager
|
|||||||||||||