472,352 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,352 software developers and data experts.

Java/C++ Code generation via XML and XSLT

Hi there,

I want to generate C++ or Java code by script, e.g. classes with
getter/setter methods. Someone told me that nowadays it is done with XML
and XSLT. I should use

- XML File which contains classnames and private members
- XSLT to transform them to code files
- XSLT processor which does the conversion

I have no idea of XSLT. What components do I need ? Is there someone out
there who has already done something like that ?

thanks
Thomas

Jul 20 '05 #1
4 3951
On Mon, 25 Aug 2003 13:40:13 +0200
Thomas Honold <th***********@siemens.com> wrote:
Hi there,

I want to generate C++ or Java code by script, e.g. classes with
getter/setter methods. Someone told me that nowadays it is done with
XML and XSLT. I should use

- XML File which contains classnames and private members
- XSLT to transform them to code files
- XSLT processor which does the conversion

I have no idea of XSLT. What components do I need ? Is there someone
out there who has already done something like that ?


You can generate Java from UML class diagram using Silvertejp, see
http://silvertejp.dnsalias.net/snigelwiki/snigel

ArgoUML also features some code generation, not as good, but both for
C++ and Java.

karl
Jul 20 '05 #2
On Mon, 25 Aug 2003 13:40:13 +0200,
Thomas Honold <th***********@siemens.com> wrote:
Hi there,

I want to generate C++ or Java code by script, e.g. classes with
getter/setter methods. Someone told me that nowadays it is done with XML
and XSLT. I should use

- XML File which contains classnames and private members
- XSLT to transform them to code files
- XSLT processor which does the conversion

I have no idea of XSLT. What components do I need ? Is there someone out
there who has already done something like that ?


I don't think, you really want to do this. Those XSLT sheets grow awfully
complex, since XSLT has not the power of a programming language in some
areas. There's a Sourceforge project called XSL4XMI with some sheets in
CVS, that generate Java from a XMI file (UML design written as XML file).

Ciao,
Andreas

Jul 20 '05 #3
Thomas Honold <th***********@siemens.com> writes:
I want to generate C++ or Java code by script, e.g. classes with
getter/setter methods.
It very much depends on what type of code, and how many you want to
generate from which type of available input.
Someone told me that nowadays it is done with XML
and XSLT.


Is it? I don't care :-)

Depending of what needs to be done, I would use:

- for simple tasks a simple shell script

- a macroprocessor like m4 for generating code based on macros
"inlined" in some Java source.

- awk for generating code completely from some simple home-made
description language

- perl for generating code from some less simple, home-made
description language

- Special tools for specific tasks, e.g. a parser generator for
building some parser.

A shell is a Unix command line interpreter which usually allows some
form of scripting (shell scripts are extremely powerful compared to
DOS/Windows BAT/CMD files). M4 and awk are classic Unix text processing
tools, perl is a Unix scripting language. Ports are available for other
platforms, too.

/Thomas
Jul 20 '05 #4
Thomas Weidenfeller wrote:
Thomas Honold <th***********@siemens.com> writes:

Someone told me that nowadays it is done with XML
and XSLT.

Is it? I don't care :-)

Depending of what needs to be done, I would use:

- for simple tasks a simple shell script

- a macroprocessor like m4 for generating code based on macros
"inlined" in some Java source.

In the past, I've done this for C++.

For a project with GUI widgets, I did a base XML source file with
information on the API, then XSL stylesheets to create a users guide, an
implemntors guide, and a test program to ensure the documentation was in
sync with the library.

For something like that, XML was most appropriate.

Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: f | last post by:
I am writing a java code generation tool. The tool will take a java class description written in xml and translate it to java code using xslt. I am...
0
by: Ray Tayek | last post by:
hi, trying to convert some csv files into xsml and pulling a few hairs out :(. using the files below. a java program will parse the csv and take...
3
by: Henri Sivonen | last post by:
I am generating XML by emitting SAX events programmatically from Java. However, there's a lot of boilerplate markup, so being able to generate code...
1
by: Jens Mueller | last post by:
Hi there, this is a Java-XML Question, so I am not sure whether this is the right place, haven't found anything better .... I try to convert a...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me...
5
by: cybernerdsx2 | last post by:
Hi, I am new to XSLT and I would like to use Java to read up the XSLT content and add in a few tags in into the template below: <xsl:template...
5
by: TZESENG | last post by:
DECEMBER 13, 2005 . Editions: N. America | Europe | Asia | Edition Preference News Analysis By Steve Hamm Source:...
6
by: Lenny Wintfeld | last post by:
Hi I'm attempting additions/changes to a Java program that (among other things) uses XSLT to transform a large (96 Mb) XML file. It runs fine on...
3
by: alireza6485 | last post by:
Hi, Could sme one please translate the following code from C to Java for me? Code : /* Polytechnic University of the Philippines ...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.