Java 输出JAXB短格式标记
我正在编写一个程序,目前以这种格式输出XML:Java 输出JAXB短格式标记,java,xml,jaxb,Java,Xml,Jaxb,我正在编写一个程序,目前以这种格式输出XML: <Id></Id> 你是说?如果是这样,请尝试使用@xmldattribute@Turing85注释相应的getter/属性(取决于您如何定义@xmlacessortype)@xmlacessortype是xmlacesstype.FIELD,类中的所有成员字段都是@xmlement。您的意思是?如果是这样,请尝试使用@xmldattribute@Turing85注释相应的getter/属性(取决于您如何定义@xmlace
<Id></Id>
你是说
?如果是这样,请尝试使用@xmldattribute
@Turing85注释相应的getter/属性(取决于您如何定义@xmlacessortype
)@xmlacessortype
是xmlacesstype.FIELD
,类中的所有成员字段都是@xmlement
。您的意思是
?如果是这样,请尝试使用@xmldattribute
@Turing85注释相应的getter/属性(取决于您如何定义@xmlacessortype
),@xmlacessortype
是xmlacesstype.FIELD
,类中的所有成员字段都是@xmlement
。
<Id/>
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MyClassType", propOrder = {
"id"
//....
})
public class MyClassType
{
@XmlElement(name = "Id", required = true)
protected String id;
//...
}