Without knowing the details, I immediately thought that it would probably use xslt for this. for example if you have something like (I appreciate
<element name="SomeEntity"> <attribute name="someAttr" type="integer" /> <complexType> <sequence> <element name="someOtherAttr" type="string" /> </sequence> </complexType> </entity>
Create a bunch of templates to translate this, for example.
<xsl:template match="element"> <xsl:apply-template select="." mode="header"/> <xsl:apply-template select="." mode="impl"/> </xsl:template> <xsl:template match="element" mode="header"> class <xsl:value-of select="@name"/> { public: <xsl:apply-template select="attribute" mode="header"/> <xsl:apply-template select="complexType/element" mode="header"/> </xsl:template> ...
Although, if the generation logic is more complex, I would probably go along the path of importing xml into the object model and process it programmatically, possibly using a template engine such as Velocity, because although it is possible the complex logic in xslt is a pain.
source share