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
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply 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: 35442
    
    9
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.


Android appsImageJ pluginsJava web charts
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12953
    
    3

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
Struts Help
No Getter method for LastName property of bean
uploading data into JTable
uploading data into JTable
How to update the xml tag attributes for the given tag