作者:夏雨荷Cassiopeia | 来源:互联网 | 2023-05-19 01:58
Iwanttorepresentthefollowingxmlintoajavaobject,andtheorderingmattersforthesub-nodes
I want to represent the following xml into a java object, and the ordering matters for the sub-nodes.
我想将以下xml表示为java对象,并且顺序对子节点很重要。
abc23423lja123423
23
2011/11/28
some desc
John Doe
mississipi
usa
- 33
- 19
- some title2
- other title3
So my class is Document:
所以我的班级是文件:
public class Document {
String version;
String id;
}
So the sub-items have to be in the same order, meaning the xml nodes in the meta-data node (item) have to be ordered as they appear in the xml file.
因此子项必须处于相同的顺序,这意味着元数据节点(项)中的xml节点必须按照它们出现在xml文件中的顺序进行排序。
How would you design this class? Using many inner classes or would you do it in a more generic way somehow?
你会如何设计这门课程?使用许多内部类或者你会以某种方式以更通用的方式执行它吗?
1 个解决方案