473,383 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 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 3992
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 looking for samples of xml files that describe...
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 care of strange names and notes that line breaks in...
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 from XML would be nice. Is there a tool that...
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 Java object to XML via SAX and let the FOP...
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 understand the different ways to do the same thing in...
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 name="hwSpecs"> <!-- adding new tags into here...
5
by: TZESENG | last post by:
DECEMBER 13, 2005 . Editions: N. America | Europe | Asia | Edition Preference News Analysis By Steve Hamm Source: http://www.businessweek.com/technology/content/dec2005/tc20051213_042973.htm...
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 small XML files but generates OutOfMemory...
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 Sta.Mesa, Manila College of Computer Management and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.