• Post Reply Bookmark Topic Watch Topic
  • New Topic

Convert xml file to java class  RSS feed

 
Sara Bony
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dear all
I am not sure it is a good place for posting my question, but because i am a beginner in java , posting it here!
Is it possible that convert a xml file to a java class?
If yes, for doing that, which parser i can use?i think it is done with xslt but i am not sure and i don,t know how?
Thanks in advance.

 
E Armitage
Rancher
Posts: 989
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google "JAXB"
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would it mean to convert an XML file to a Java class? Can you give a simple example of the input and the output of such a transformation?
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:...Can you give a simple example of the input and the output of such a transformation?

giggle
 
Sara Bony
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:What would it mean to convert an XML file to a Java class? Can you give a simple example of the input and the output of such a transformation?

I am a beginner as i said and i don,t have any example about that.
But what i should do
: for a simulation with a simulator that written in java.
i should convert my simulation data which is in form of xml file, to a java class.

 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That you "should" do that suggests that there is someone who could give you clarity if you have questions. XML is a data format, while Java classes contain code. There is no way to convert one to other without knowing what that means. So that's what you need to find out.
 
Sara Bony
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:That you "should" do that suggests that there is someone who could give you clarity if you have questions. XML is a data format, while Java classes contain code. There is no way to convert one to other without knowing what that means. So that's what you need to find out.

Ok.
Maybe i couldn,t say my meaning exactly.
I am familiar with the concepts of class and xml.
I have one xml file that describe a workflow.Workflow has its own attributes.
A java class also has some attributes and features.
Then i want to generate corresponding class of a specific class i.e parsing the workflow to generate corresponding class of it in purpose of simulate workflow executing in java.
Now my question is:
Which one of parser in java can do that.
I also google JAXB. i think its better. what do you think?
Thanks.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!