关于第一个问题参考下面的结构:<?xml version="1.0" ?>
<inherit>
<father>
<fatherId>1</fatherId>
<fatherName>father</fatherName>
</father>
<childList>
<child>
<childId>2</childId>
<childName>childName</childName>
<fatherId>1</fatherId>
</child>
<child>
<childId>3</childId>
<childName>childName</childName>
<fatherId>1</fatherId>
</child>
</childList>
</inherit>
也可以所<child>下面的<fatherId>作为一个属性放在<child>元素里面。第二个问题没遇过到,估计是你的Factory配置有问题,取消Factory的所有feature看看
<inherit>
<father>
<fatherId>1</fatherId>
<fatherName>father</fatherName>
</father>
<childList>
<child>
<childId>2</childId>
<childName>childName</childName>
<fatherId>1</fatherId>
</child>
<child>
<childId>3</childId>
<childName>childName</childName>
<fatherId>1</fatherId>
</child>
</childList>
</inherit>
也可以所<child>下面的<fatherId>作为一个属性放在<child>元素里面。第二个问题没遇过到,估计是你的Factory配置有问题,取消Factory的所有feature看看
第一个问题,如果我的这种树形结构有很多层,有多少层也是未知的,那么应该怎么表示呢?
<inherit>
<father>
<fatherId>1</fatherId>
<fatherName>father</fatherName>
</father>
<father>
<fatherId>2</fatherId>
<fatherName>father</fatherName>
</father>
<childList>
<child>
<childId>2</childId>
<childName>childName</childName>
<fatherId>1</fatherId>
</child>
<child>
<childId>3</childId>
<childName>childName</childName>
<fatherId>1</fatherId>
</child>
<!--到n....-->
<child>
<childId>4</childId>
<childName>childName</childName>
<fatherId>1</fatherId>
</child>
<child>
<childId>2</childId>
<childName>childName</childName>
<fatherId>1</fatherId>
</child>
</childList>
</inherit>不知道你说的是不是child有多层
利用XML的TREE的性质直接输出树形结构,你的方法好像还要通过parentid来找父亲节点,如果是
这样我用XML来存放树形结构就没有什么意义了,还不如直接放在数据库中,通过数据库存取。