关于第一个问题参考下面的结构:<?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看看

解决方案 »

  1.   

    谢谢 TyroneChan(油亮脖子金黃腳)!
    第一个问题,如果我的这种树形结构有很多层,有多少层也是未知的,那么应该怎么表示呢?
      

  2.   

    有多少层都没问题啦,就直接添加<child></child>就行了嘛<?xml version="1.0" ?>
    <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有多层
      

  3.   

    你可能理解错了,我是指树形结构有多层。而且有多少层未知。另外我用XML的目的就是想直接能
    利用XML的TREE的性质直接输出树形结构,你的方法好像还要通过parentid来找父亲节点,如果是
    这样我用XML来存放树形结构就没有什么意义了,还不如直接放在数据库中,通过数据库存取。