Ia m using using JAXB to create xml file.So I want to create attribute using underscore(_). If I took qpack_name as field name its taking qpackName,But requirement is I need qpack_name like this so please tell how to do.
<qpack qtnrid="319" duration="120" qpack_id="MB0041_SET5" qpack_name="MB0041"><passages><passage id="1595"><label><![CDATA[<p style="text-align:center;hyphenate:auto;font-family:Calibri;font-size:10pt;"><span>Passage Label 1</span></p>]]></label>
posted 3 years ago
If I took qpack_name as field name its taking qpackName,But requirement is I need qpack_name like this so please tell how to do.
In the class, under the assumption that you use the default naming, Qpack, you have a field qpack_name. You should already have an annotation @XmlAttribute such as on its getter. You can then change the annotation of it adding name you want it to appear in the xml document.
Variants are possible according to your concrete set up. But as long as the name for the xml is specified like qpack_name, the variable name is quite arbitrary: you don't even need to name it qpack_name (it might look awkward in the bean...) in the class.