I wanted to generate some XML Schemas for my project. I have some Java Classes, like this one:
package com.fortresswars.entity;
import com.fortresswars.entity.properties.Armor;
import com.jme3.scene.Spatial;
public abstract class Object extends Thing {
public Armor armor;
public short hpMax;
public boolean walkable = false;
public short hpCurrent;
public boolean alive;
public Spatial object;
public GameObject() {
this.hpMax = hpMax;
this.hpCurrent = hpMax;
}
public void setAlive(boolean alive) {
this.alive = alive;
}
public void setHpCurrent(short hpCurrent) {
this.hpCurrent = hpCurrent;
}
public void addHpCurrent(short hpToAdd) {
this.hpCurrent += hpToAdd;
}
}
package com.fortresswars.entity;
import com.jme3.texture.Image;
import eu.javaspecialists.tools.apt.NoArgsConstructor;
@NoArgsConstructor
public abstract class Thing {
Image icon;
public Thing() {
}
}
I wanted to generate a XML Schema based on those classes for my project, so the other developers can build a XML file based on that generated Schema and they can validate the information before sending to me. But I don't know what is best, to generate a XML Schema based on a class, or generate a class based on a XML Schema. Please, could you point out what tools there is out there to do it, and the advantages of using each one of those approaches?
I know that there is a tool called JAXB, but I don't know if it does both of those jobs, or any of them.