473,659 Members | 2,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4011
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
2140
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 java class. Any help appreciated. ff
0
2162
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 them. eventiually i want to generate the xslt from a xml file (all the files and java code are at http://tayek.com/~ray/spy1/). the java code (1.4) does the right thing (it just does the transformation). xmlspy seems really broken when i hit...
3
1897
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 would take an XML file like this <?args org.xml.sax.ContentHandler ch, com.example.Foo foo ?> <baz xmlns="http://example.com/fooml/"> <?code foo.bar(ch); ?> </baz>
1
3103
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 Transformer convert that via XSLT to valid XSL-FO. So I define a SAXReader which fires the SAX Events for the Java Object. This works fine and the Transformation to PDF is ok. However, I have one object which contains an XHTML String and the tags
11
9243
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 C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
5
1682
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 from Java --> </xsl:template> So, what kind of parser or tools can I use in my Java source code to
5
2312
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 Peter Yared, CEO of software maker ActiveGrid, spent a critical chapter of his career steeped in Java, the programming language developed by Sun Microsystems (SUNW). In the late 1990s, Yared was chief technology officer
6
4979
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 exceptions with large XML files. I tried a simple punt of -Xmx512MB but that didn't work. In the future, the input XML file may become considerably bigger than 96 MB, so even if it did work, it probably would be putting off the inevitable to some later...
3
2720
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 Information Technology A
0
8850
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8626
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6178
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2749
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.