I wanted to create some XML schemas for my project. I have Java classes like:
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 create an XML schema based on these classes for my project, so other developers can create an XML file based on this generated schema, and they can check the information before sending it to me. But I don’t know what is best for creating an XML schema based on a class or creating a class based on an XML schema. Please, could you indicate what tools are there and the advantages of using each of these approaches?
I know that there is a JAXB tool, but I don’t know if it performs both of these tasks or any of them.
source
share