这种格式肯定不行!缺少数据定义部分!也不符合ado要求的xml格式!
两种方法,要嘛自己处理xml文件;要嘛修改文件为合法格式!
修改结构如下:
<?xml version="1.0" encoding="gb2312"?>
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly' rs:updatable='true'>
<s:AttributeType name='c0' rs:name='区本号' rs:number='1' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'
rs:basetable='QB' rs:basecolumn='区本号' rs:keycolumn='true'>
<s:datatype dt:type='string' dt:maxLength='4'/>
</s:AttributeType>
<s:AttributeType name='c1' rs:name='区域说明' rs:number='2' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'
rs:basetable='QB' rs:basecolumn='区域说明'>
<s:datatype dt:type='string' dt:maxLength='50'/>
</s:AttributeType>
<s:AttributeType name='c2' rs:name='区本状态' rs:number='3' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'
rs:basetable='QB' rs:basecolumn='区本状态'>
<s:datatype dt:type='string' dt:maxLength='20'/>
</s:AttributeType>
<s:extends type='rs:rowbase'/>
</s:ElementType>
</s:Schema>
上面部分结构只是定义表结构,可以固定,下面部分为数据部分!
<rs:data>
<z:row c0='0101' c1='十区10~20栋' c2='初始状态'/>
<z:row c0='0103' c1='十区21~40栋' c2='正在抄表'/>
</rs:data>
</xml>
这样就可以用ADODataSet.LoadFromFile('X.xml')了!