I'm using the annotations from the package javax.xml.bind.annotation
to construct SKOS XML files. I have some trouble about the best way to realize lines like the following (please, observe that the rdf
prefix has been set in the package-info.java
file):
<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#ConceptScheme" />
Currently, I do it by defining a class and by adding a property to the class, e.g.
@XmlRootElement(name = "type")
@XmlAccessorType(XmlAccessType.FIELD)
class Type{
@XmlAttribute(name="rdf:resource")
protected final String res="http://www.w3.org/2004/02/skos/core#ConceptScheme";
}
and then I create a field in the class that I'm going to serialize, e.g.
@XmlElement(name="type")
private Type type = new Type();
Is this the only way or I can save time by using a more compact approach?