JAXB无尽的数据结构,递归绑定?
在开始一个项目之前,我想先简单了解一下。
如果我有这样的结构:
<root>
<a>
<a>
<a>
<a>
<a/>
</a>
</a>
</a>
<a>
</a>
</a>
a
元素可以容纳 a
元素,而且深度无限。
我是否只写一个A类,然后给它一个List作为成员?那么 JAXB 会自动发挥魔法吗?或者这种结构不可能吗?
sBefore starting a project I wanted to get a short heads up here.
If I have a structure like this:
<root>
<a>
<a>
<a>
<a>
<a/>
</a>
</a>
</a>
<a>
</a>
</a>
The a
element can hold a
elements and this endlessly deep.
Do I just write a class A and then give it a List as a member? JAXB does the magic automatically then? Or is this structure not possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您可以拥有以下内容:
以及您的JAXB (JSR-222) 实现将正确地编组它。
相关示例
Yes you can have the following:
And your JAXB (JSR-222) implementation will marshal it correctly.
Related Example