Reputation: 51
I working on JAXB to using java object I am creating xml.But im using javaclass fields Like
qpack_id as attrubute it creating in xml file like qpackId
so how can i use _(underscore) in jaxB please guide me.
xml file should create bellow attibute
<qpack " qpack_id="MB0046_SET4" qpack_name="MB0046">
</qpack>
Upvotes: 3
Views: 3142
Reputation: 149017
Starting from Java Classes
You can use the XmlAttribute
annotation to specify a name.
@XmlAttribute(name="qpack_name")
public String getQPackName() {
return qPackName;
}
Starting from XML Schema
If you are talking about generating Java classes from an XML schema and preserving the _
character in the Java properties names see the answer below for a complete example:
Upvotes: 3