| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 577 人关注过本帖
标题:问题:delphi的RecordNodeList读取XML出错
只看楼主 加入收藏
gyqlove
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-5-19
收藏
 问题点数:0 回复次数:0 
问题:delphi的RecordNodeList读取XML出错
问题:delphi的RecordNodeList读取XML出错(读取XML子节点时,把多个子节点赋值给RecordNodeList出错),
RecordNodeList有大小限制吗?XML文件的其中子节点少就可以读取,多了读取就报错,是别的原因吗?  

代码:
function TTables.getTableFields(TableName:string):TVirtualTable;
var
 RootNodeList,RecordNodeList:IXMLNodeList;
 TableNode:IXMLNode;
 MyTf:TFields;
 i,m:Integer;
 SrcTN,DestTN,WellFN:string;
begin
 Result:=nil;
  RootNodeList:=MyXmlDoc.DocumentElement.ChildNodes;
  if RootNodeList.Count>0 then
  begin
   TableNode:=RootNodeList.FindNode(TableName);
   if TableNode.HasChildNodes then
   begin
     try
      Result:=TVirtualTable.Create(nil);
         Result.Active:=True;
     except
       FreeAndNil(result);
       raise TmyException.Create('虚拟表建立错误',self);
       exit;
     end;
     BuildFields(Result);

      DestTN:=TableNode.Attributes['DEST'];
     SrcTN:=TableName;
     WellFN:=TableNode.Attributes['WELLFIELD'];
     if TableNode.HasChildNodes then
     begin
       RecordNodeList:=TableNode.ChildNodes;   //在这个地方报错了(判断JJBSJ下面有字节点后,把子节点赋值给RecordNodeList时报错)
        m:=RecordNodeList.Count;
       for i:=0 to m-1 do
       begin
        TableNode:=RecordNodeList[i];
        Result.Append;
        Result.FieldByName('SrcTableName').AsString:=SrcTN;
        Result.FieldByName('DestTableName').AsString:=DestTN;
        Result.FieldByName('WellNameFieldName').AsString:=WellFN;
        Result.FieldByName('SrcFieldName').AsString:=TableNode.Attributes['SRC'];
        Result.FieldByName('DestFieldName').AsString:=TableNode.Attributes['DEST'];
        Result.FieldByName('FiledType').AsString:=TableNode.Attributes['TYPE'];
        Result.FieldByName('FieldLen').AsInteger:=strtoint(TableNode.Attributes['LEN']);
        Result.FieldByName('IsKey').AsBoolean:=strtobool(TableNode.Attributes['ISKEY']);
       end;


     end;

   end;
  end ;
end;


XML文件:

<?xml version="1.0" encoding="utf-8"?>
<TABLES>
  <JJBSJ DEST="jjbsj" WELLFIELD="JM">
    <COLUMN SRC="JM" DEST="JM" TYPE="字符型" LEN="30" ISKEY="1" />
    <COLUMN SRC="JB" DEST="JB" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="GZ" DEST="GZ" TYPE="字符型" LEN="255" ISKEY="0" />
    <COLUMN SRC="ZJFS" DEST="ZJFS" TYPE="字符型" LEN="255" ISKEY="0" />
    <COLUMN SRC="JD" DEST="JD" TYPE="字符型" LEN="50" ISKEY="0" />
    <COLUMN SRC="DLWZ" DEST="DLWZ" TYPE="字符型" LEN="255" ISKEY="0" />
    <COLUMN SRC="DZ" DEST="DZ" TYPE="字符型" LEN="50" ISKEY="0" />
    <COLUMN SRC="GZWZ" DEST="GZWZ" TYPE="字符型" LEN="255" ISKEY="0" />
    <COLUMN SRC="JPD" DEST="JPD" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="JYT" DEST="JYT" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="JDQ" DEST="JDQ" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="JGZ" DEST="JGZ" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="ZJJD" DEST="ZJJD" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="CXWZ" DEST="CXWZ" TYPE="字符型" LEN="50" ISKEY="0" />
    <COLUMN SRC="DZJD" DEST="DZJD" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="LJDW" DEST="LJDW" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="LJJM" DEST="LJJM" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="LJJL" DEST="LJJL" TYPE="字符型" LEN="10" ISKEY="0" />
    <COLUMN SRC="LJFW" DEST="LJFW" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="SJJD" DEST="SJJD" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="SJWD" DEST="SJWD" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="SJJD1" DEST="SJJD1" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="SJWD1" DEST="SJWD1" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="PLSJFW" DEST="PLSJFW" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="PLSJJL" DEST="PLSJJL" TYPE="字符型" LEN="10" ISKEY="0" />
    <COLUMN SRC="BXG" DEST="BXG" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="BXHB" DEST="BXHB" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="SS" DEST="SS" TYPE="字符型" LEN="10" ISKEY="0" />
    <COLUMN SRC="SJJS" DEST="SJJS" TYPE="字符型" LEN="10" ISKEY="0" />
    <COLUMN SRC="SJCW" DEST="SJCW" TYPE="字符型" LEN="200" ISKEY="0" />
    <COLUMN SRC="MDC" DEST="MDC" TYPE="备注型" LEN="16" ISKEY="0" />
    <COLUMN SRC="WZJS" DEST="WZJS" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="WZCW" DEST="WZCW" TYPE="字符型" LEN="200" ISKEY="0" />
    <COLUMN SRC="WJFF" DEST="WJFF" TYPE="字符型" LEN="255" ISKEY="0" />
    <COLUMN SRC="WZRQ" DEST="WZRQ" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="WJRQ" DEST="WJRQ" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="ZTCX4" DEST="ZTCX4" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="TGCX4" DEST="TGCX4" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="ZTCX1" DEST="ZTCX1" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="TGCX1" DEST="TGCX1" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="ZTCX2" DEST="ZTCX2" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="TGCX2" DEST="TGCX2" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="ZTCX3" DEST="ZTCX3" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="TGCX3" DEST="TGCX3" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="BZ" DEST="BZ" TYPE="备注型" LEN="16" ISKEY="0" />
    <COLUMN SRC="TID" DEST="TID" TYPE="日期型" LEN="8" ISKEY="0" />
    <COLUMN SRC="PHONE" DEST="PHONE" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="LJQSJS" DEST="LJQSJS" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="DZSJ" DEST="DZSJ" TYPE="字符型" LEN="255" ISKEY="0" />
    <COLUMN SRC="QSYDWMC" DEST="QSYDWMC" TYPE="字符型" LEN="255" ISKEY="0" />
    <COLUMN SRC="ZJMD" DEST="ZJMD" TYPE="备注型" LEN="16" ISKEY="0" />
    <COLUMN SRC="SJCS" DEST="SJCS" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="DMHB" DEST="DMHB" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="RGJD" DEST="RGJD" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="DMSLLZHL" DEST="DMSLLZHL" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="SJJ" DEST="SJJ" TYPE="字符型" LEN="50" ISKEY="0" />
    <COLUMN SRC="SJJJ" DEST="SJJJ" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="YCDJSD1" DEST="YCDJSD1" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="YCDJSD2" DEST="YCDJSD2" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="WJZQ" DEST="WJZQ" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="TBR" DEST="TBR" TYPE="字符型" LEN="50" ISKEY="0" />
    <COLUMN SRC="SHR" DEST="SHR" TYPE="字符型" LEN="50" ISKEY="0" />
    <COLUMN SRC="WZCS" DEST="WZCS" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="KZSJ" DEST="KZSJ" TYPE="日期型" LEN="8" ISKEY="0" />
    <COLUMN SRC="WZSJ" DEST="WZSJ" TYPE="日期型" LEN="8" ISKEY="0" />
    <COLUMN SRC="WJSJ" DEST="WJSJ" TYPE="日期型" LEN="8" ISKEY="0" />
    <COLUMN SRC="JKHZB" DEST="JKHZB" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="JKZZB" DEST="JKZZB" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="ZT" DEST="ZT" TYPE="整型" LEN="4" ISKEY="0" />
    <COLUMN SRC="ZXDQSD" DEST="ZXDQSD" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="ZXZTWZ" DEST="ZXZTWZ" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="ZXGXSJ" DEST="ZXGXSJ" TYPE="日期型" LEN="8" ISKEY="0" />
    <COLUMN SRC="SFJS" DEST="SFJS" TYPE="字符型" LEN="2" ISKEY="0" />
    <COLUMN SRC="LJYLX" DEST="LJYLX" TYPE="字符型" LEN="255" ISKEY="0" />
    <COLUMN SRC="DQ" DEST="DQ" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="SNFS1" DEST="SNFS1" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="SNFS2" DEST="SNFS2" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="SNFS3" DEST="SNFS3" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="SNFS4" DEST="SNFS4" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="XDA" DEST="XDA" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="XDB" DEST="XDB" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="XDC" DEST="XDC" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="LJZZJS" DEST="LJZZJS" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="XCLXDH" DEST="XCLXDH" TYPE="字符型" LEN="50" ISKEY="0" />
    <COLUMN SRC="KZRQ" DEST="KZRQ" TYPE="日期型" LEN="8" ISKEY="0" />
    <COLUMN SRC="LJXM" DEST="LJXM" TYPE="字符型" LEN="200" ISKEY="0" />
    <COLUMN SRC="ALLOWRECEIVE" DEST="ALLOWRECEIVE" TYPE="整型" LEN="4" ISKEY="0" />
    <COLUMN SRC="SJX" DEST="SJX" TYPE="数值型" LEN="19" ISKEY="0" />
    <COLUMN SRC="SJY" DEST="SJY" TYPE="数值型" LEN="19" ISKEY="0" />
    <COLUMN SRC="SJX1" DEST="SJX1" TYPE="数值型" LEN="19" ISKEY="0" />
    <COLUMN SRC="SJY1" DEST="SJY1" TYPE="数值型" LEN="19" ISKEY="0" />
    <COLUMN SRC="SHEJIZTCX1" DEST="SHEJIZTCX1" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="SHEJIZTCX2" DEST="SHEJIZTCX2" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="SHEJIZTCX3" DEST="SHEJIZTCX3" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="SHEJIZTCX4" DEST="SHEJIZTCX4" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="SHEJITGCX1" DEST="SHEJITGCX1" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="SHEJITGCX2" DEST="SHEJITGCX2" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="SHEJITGCX3" DEST="SHEJITGCX3" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="SHEJITGCX4" DEST="SHEJITGCX4" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="SHEJISNFS1" DEST="SHEJISNFS1" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="SHEJISNFS2" DEST="SHEJISNFS2" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="SHEJISNFS3" DEST="SHEJISNFS3" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="SHEJISNFS4" DEST="SHEJISNFS4" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="SHEJIXDA" DEST="SHEJIXDA" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="SHEJIXDB" DEST="SHEJIXDB" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="SHEJIXDC" DEST="SHEJIXDC" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="ISLOCK" DEST="ISLOCK" TYPE="字符型" LEN="5" ISKEY="0" />
    <COLUMN SRC="JQB" DEST="JQB" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="JQBLX" DEST="JQBLX" TYPE="字符型" LEN="100" ISKEY="0" />
    <COLUMN SRC="ZJJK" DEST="ZJJK" TYPE="备注型" LEN="16" ISKEY="0" />
    <COLUMN SRC="FJKQSSD" DEST="FJKQSSD" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="FJKZZSD" DEST="FJKZZSD" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="SFXGQ" DEST="SFXGQ" TYPE="字符型" LEN="10" ISKEY="0" />
    <COLUMN SRC="XGQQSSD" DEST="XGQQSSD" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="XGQZZSD" DEST="XGQZZSD" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="YJGZ" DEST="YJGZ" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="EJGZ" DEST="EJGZ" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="XS" DEST="XS" TYPE="整型" LEN="4" ISKEY="0" />
    <COLUMN SRC="DTWZ1" DEST="DTWZ1" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="DTWZ2" DEST="DTWZ2" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="DTWZ3" DEST="DTWZ3" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="DTWZ4" DEST="DTWZ4" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="FJKEJSNFS" DEST="FJKEJSNFS" TYPE="数值型" LEN="8" ISKEY="0" />
    <COLUMN SRC="ZJLX" DEST="ZJLX" TYPE="字符型" LEN="40" ISKEY="0" />
    <COLUMN SRC="PTJL" DEST="PTJL" TYPE="字符型" LEN="20" ISKEY="0" />
    <COLUMN SRC="JSY" DEST="JSY" TYPE="字符型" LEN="20" ISKEY="0" />
  </JJBSJ>
<TABLES>
搜索更多相关主题的帖子: delphi XML 
2010-05-19 09:58
快速回复:问题:delphi的RecordNodeList读取XML出错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.034068 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved