Site Navigation:

pyulmgen

Customization

Customization can be achieved easily through the use of generation templates.

A minimalist program to read a UMM XML file and apply a generation template to it would be:

import sys

import stringtemplate

import ulmgen.ummparser

def runxst(xmlfile,stgfile,tmpl):

up = ulmgen.ummparser.parse(xmlfile)

group = stringtemplate.StringTemplateGroup(file(stgfile))

tmpl = group.getInstanceOf(tmpl)

tmpl["model"] = up.model

print tmpl