新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 关于 XML 的一般性技术讨论,提供 XML入门资料 和 XML教程
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 XML基础 』 → 求助:castor中报 unable to find FieldDescriptor 的错误 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 2700 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 求助:castor中报 unable to find FieldDescriptor 的错误 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     小刚 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:1
      积分:56
      门派:XML.ORG.CN
      注册:2006/5/19

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给小刚发送一个短消息 把小刚加入好友 查看小刚的个人资料 搜索小刚在『 XML基础 』的所有贴子 引用回复这个贴子 回复这个贴子 查看小刚的博客楼主
    发贴心情 求助:castor中报 unable to find FieldDescriptor 的错误

    本人正在使用castor操作xml文件。进行数据的读和写。但遇到困难:
    我的xml文件:backupInfo.xml
    <?xml version="1.0"?>

    <BackupInfoRecoed name = "This is a list of backup info">
     
      <BackupInfo name = "1">
      <backupDate>20060505</backupDate>
      <filepath>deploybed/backup/1</filepath>
      <description>this is no. 1</description>
      </BackupInfo>
      
      <BackupInfo name = "2">
      <backupDate>20060508</backupDate>
      <filepath>deploybed/backup/2</filepath>
      <description>this is no. 2</description>
      </BackupInfo>
     
    </BackupInfoRecoed>
    我的mapping文件:backupMapping.xml
    <?xml version="1.0"?>
    <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version 1.0//EN" "http://castor.exolab.org/mapping.dtd">
    <mapping>

        <class name="com.workssys.aunm.commons.pojo.BackupInfo">
      <field name="name" type="string">
      <bind-xml name="name" node="attribute" />
      </field>
      <field name="backupDate" type="string" />
      <field name="filepath" type="string" />
      <field name="description" type="string" />
     </class>
     
      <class name="com.workssys.aunm.commons.pojo.BackupInfoRecoed">
      <field name="name" type="string">
      <bind-xml name="name" node="attribute" />
      </field>
      <field name="backupInfos" type="com.workssys.aunm.commons.pojo.BackupInfo" collection="collection" />
     </class>
     
    </mapping>

    BackupInfo bean:(getter和setter方法省略)
        String name;
        String backupDate;
        String filepath;
        String description;

    BackupInfoRecoed bean:(getter和setter方法省略)
        String name
        List backupInfos = new ArrayList();

    读取xml的代码:
             Mapping mapping = new Mapping();
             mapping.loadMapping("backupMapping.xml");
             Unmarshaller un = new Unmarshaller(BackupInfoRecoed.class);
             un.setMapping(mapping);                  
             //-- Read in the Addressbook using the mapping
             FileReader in = new FileReader("backupInfo.xml");
             //un.setIgnoreExtraElements(true);
             BackupInfoRecoed backupRec = (BackupInfoRecoed) un.unmarshal(in);
    执行最后一句时报错:
    unable to find FieldDescriptor for 'BackupInfo' in ClassDescriptor of backup-info-           recoed{file: [not available]; line: 5; column: 26}
         at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:671)
         at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:565)
    请求帮助如何解决该问题。


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2006/5/19 11:31:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 XML基础 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2025/10/18 15:45:27

    本主题贴数1,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    62.500ms