Unable to understand JAXB Unmarshalling behaviour

陌路散爱 提交于 2019-12-02 01:00:46

The problem you are seeing is because the JAXBContext isn't aware of your ObjectFactory class that contains the @XmlElementDecl annotation for the book element.

When you create a JAXBContext on a package name, the it will automatically pull in the ObjectFactory class. If you create a JAXContext on classes you need to explicitly include the class with the @XmlRegistry annotation (ObjectFactory in this case).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!