我想做大 XML 的部分解组。
XML 具有以下结构:
<Records>
<Contract>
...
</Contract>
<Contract>
...
</Contract>
...
<Contract>
...
</Contract>
<Contract>
...
</Contract>
</Records>
使用 XJC 生成的结果类:
- Records
|- Contract
如果我遵循这些(来自 jaxb-ri 的示例),我会收到错误消息:
Exception in thread "main" javax.xml.bind.UnmarshalException: unexpected element (uri:"http://somedomain.com", local:"Contract"). Expected elements are <{http://somedomain.com}Records>
如果我使用:
<jaxb:globalBindings localScoping="toplevel"/>
我得到错误:
org.xml.sax.SAXParseException: A class/interface with the same name "com.my.package.Text" is already in use. Use a class customization to resolve this conflict.
但我需要改变很多课程。这不是解决方案。