我需要使用xml以下列格式表示某些数据。在xml中表示嵌套数据的最佳方式
root-> col1-item1 -> col2-item1 -> col3-item1 -> col3-item2 -> col3-item3 -> col2-item2 -> col3-item1 -> col3-item2 -> col1-item2 -> col2-item1 -> col3-item1
我见过有关这种实现的帖子,但我仍然对实现这一点的最佳方式感到困惑。 以下哪种方式应该用来表示这些数据?还有其他更好的方法吗?
1方法:
<column1items>
<col1-item text="col1-1st item">
<col2-item> col2 - 1
<col3-item> col3 - 1</col3-item>
<col3-item> col3 - 2</col3-item>
<col3-item> col3 - 3</col3-item>
<col3-item> col3 - 4</col3-item>
</col2-item>
</col1-item>
</column1items>
第二个方法:
<column1items>
<col1-item>
<text> col1-1st item </text>
<col2-items>
<col2-item>
<text> col2 - 1 </text>
<col3-items>
<col3-item> <text> col3 - 1 </text> </col3-item>
<col3-item> <text> col3 - 2 </text> </col3-item>
<col3-item> <text> col3 - 3 </text> </col3-item>
<col3-item> <text> col3 - 4 </text> </col3-item>
</col3-items>
</col2-item>
</col2-items>
</col1-item>
</column1items>
这里的问题是:可以将文本有属性(格式(粗体,斜体,花哨的字体) – Benoit 2011-12-22 13:50:18
@Benoit不,它只是一个普通的文本同样的解决方案应该是易于阅读 – Nilesh 2011-12-22 13:54:27