aspose file tools*
The moose likes XML and Related Technologies and the fly likes Converting Java to XML file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Converting Java to XML file" Watch "Converting Java to XML file" New topic
Author

Converting Java to XML file

Parameswaran Thangavel
Ranch Hand

Joined: Mar 01, 2005
Posts: 485
hi all
i am looking for a tool which do the below requirement.

Given the Java file, it will generate the XML file for that java file.

say java class like

Class Student{
private int age;
private String Name;
private char Sex;

}


the output i am expecting is

<Student>
<age></age>
<Name></Name>
<Sex></Sex>
</Student>

I donno whether there might me one. but i want to convert the exisitng java class to XML file as said above. since i am having numerous java file i am looking for the tool of above kind.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
If the class conforms to the Beans specification, then you can use the java.beans.XMLEncoder/Decoder classes. Otherwise, have a look at libraries like XMLBeans.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14432
    
  23

Have a look at JAXB: http://java.sun.com/webservices/jaxb/
Or at Castor: http://www.castor.org/


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
dennis zined
Ranch Hand

Joined: Mar 07, 2003
Posts: 330
Castor is your friend...


SCJP 1.4<br />SCWCD 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Converting Java to XML file