jaxb unmarshall xml数据的默认规则是什么? [英] what is the default rule for jaxb unmarshall the xml data?
问题描述
想知道,有一个没有任何注释的类,jaxb如何将xml数据解组到类。
Want to know, having a class without any annotation, how the jaxb unmarshall the xml data to class.
我发现它可以采用以下
如果我在xml中有一个节点label
If I have an node "label" in the xml
我在类中有_label字段和getLabel和setLabel方法。
I have "_label" field in the class and "getLabel" and "setLabel" method.
jaxb可以解散它。只是想知道它的默认规则。
jaxb can unmarshall it sucsessully. Just want to know its default rule.
推荐答案
以下内容来自JAXB 2规范(JSR-222 ):
The following is from the JAXB 2 specification (JSR-222):
8.12默认映射
本节介绍程序元素的默认
映射。
默认映射是以
的默认注释来指定的,这些注释是
,即使在他们缺席的情况下也被视为应用于程序
元素。
This section describes the default mapping of program elements. The default mapping is specified in terms of default annotations that are considered to apply to a program element even in their absence.
8.12.1 Java标识符到XML名称
以下是不同标识符的默认映射
:
The following is the default mapping for different identifiers:
- 类名:使用
java.beans.Introspector通过de capitalization
将类名映射到XML名称.decapitalize(类
名称)。 - enumtype name:enumtype name使用
java.beans.Introspector通过de
大写映射到XML名称.decapitalize(enumtype
name)。 - 属性名称(例如地址)是由JavaBean de
从JavaBean访问方法
(例如getAddress)派生的。 JavaBean
属性名的大小写
java.beans.Introspector.decapitalize(JavaBeanAcc
essMethod)
这篇关于jaxb unmarshall xml数据的默认规则是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!