use xml to describe java class

F

f

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
 
G

GIMME

Why can't you use java 1.4's built in code which works on java beans ...

import java.io.*;
import java.beans.*;

public class ENXML
{

public static void encode( String FileName , A a )
throws FileNotFoundException
{
XMLEncoder encoder = new XMLEncoder(
new BufferedOutputStream(
new FileOutputStream( FileName )));

encoder.writeObject( a );
encoder.close();
}

public static A decode( String FileName )
throws FileNotFoundException
{
XMLDecoder decoder = new XMLDecoder(
new BufferedInputStream(
new FileInputStream( FileName )));

A a = (A)decoder.readObject();
decoder.close();
return a;
}

}
 

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
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top