我有这个绑定文件
<?xml version="1.0"?>
<xml-bindings
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
package-name="com">
<java-types>
<java-type name="com.test.Root">
<xml-root-element name="root"/>
<java-attributes>
<xml-element java-attribute="element" xml-path="element" type="com.Element"/>
</java-attributes>
</java-type>
<java-type name="com.Element"></java-type>
</java-types>
包结构和类位置可以从此绑定文件中读取。 当我解组时,我得到以下异常。有人可以告诉我为什么以及如何解决这个问题?我不想改变我的包结构。
JAXBException: The java-type with package [com.test] is not allowed in the bindings file keyed on package [com].
答案 0 :(得分:1)
每个包需要一个绑定文件。 BTW在xml-bindings
元素中指定包名称时,您无需完全限定java-type
元素上的名称。