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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 39547
    
  27
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.


Ping & DNS - updated with new look and Ping home screen widget
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13872
    
  10

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 7 API documentation
Scala Notes - My blog about Scala
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
 
Similar Threads
How to update the xml tag attributes for the given tag
Struts Help
uploading data into JTable
uploading data into JTable
No Getter method for LastName property of bean