Java/C++ Code generation via XML and XSLT

Thomas Honold

Usenet Archive
Joined
Aug 25, 2003
Messages
2
Reaction score
0
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
 

Andreas Rueckert

Usenet Archive
Joined
Jul 10, 2003
Messages
16
Reaction score
0
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
 

karl wettin

Usenet Archive
Joined
May 6, 2003
Messages
20
Reaction score
0
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
 

Thomas Weidenfeller

Usenet Archive
Joined
May 25, 2000
Messages
1,555
Reaction score
0
Thomas Honold said:
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
 

Jon A. Cruz

Usenet Archive
Joined
Jan 16, 2000
Messages
261
Reaction score
0
Thomas said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top