主要是实现一个四层下拉框的制作
在后台用DataSet读数据库并且按照XML的结构写入XML前台直接读XML(不知道上面这样做对不对?)现在数据库有张CommodityType 表
create table CommodityType 
(
CommodityTypeID      int                  not null,   商品类型ID
TypeName             varchar(100)         null,       商品名
Steps                int                  null,       在第几层
FatherType           int                  null,       父层的ID
constraint PK_COMMODITYTYPE primary key  (CommodityTypeID)
)
go
这几个字段意思我举例说明
insert into CommodityType values('01000000','电脑/软件/网络/办公','1','')
insert into CommodityType values('01010000','电脑硬件,'2','01000000')
insert into CommodityType values('01010100','鼠标,'3','01010000')
insert into CommodityType values('01010101','IBM','4','01010100')意思就 电脑/软件/网络/办公件 里有 电脑硬件,电脑硬件有鼠标...现在要把从数据库把数据用DataSet读取,并且写到Promulgate.xml文件里面问题来了:
但是这要怎么写才能写出这种xml格式出来..,郁闷
不知道怎么写了..大虾99Promulgate.xml:
<?xml version="1.0" encoding="utf-8" ?>
<FAQ xmlns="http://tempuri.org/Promulgate.xsd">
<category value="0" name="选择所有产品类别">
<one value="01000000" text="电脑/软件/网络/办公">
<two value="01010000" text="电脑硬件">
<three value="01010100" text="鼠标">
<four value="01010101" text="罗技" />
<four value="01010102" text="微软" />
<four value="01010103" text="IBM" />
</three>
<three value="01010200" text="摄像头">
<four value="01010201" text="罗技/Logitech" />
<four value="01010202" text="良田" />
<four value="01010203" text="极速" />
</three>
<three value="01010300" text="主板">
<four value="01010301" text="昂达" />
<four value="01010302" text="技嘉/GIGABYTE" />
<four value="01010303" text="华擎" />
</three>
</two>
<two value="01020000" text="服务器/工作站/网络设备">
<three value="01020100" text="路由器" />
<three value="01020200" text="SCSI设备" />
<three value="01020300" text="服务器/server" />
</two>
</one>
<one value="02000000" text="运动/休闲/户外/乐器">
<two value="02010000" text="运动用品/鞋/服">
<three value="02010100" text="运动包/帽/配件">
<four value="02010101" text="耐克/NIKE" />
<four value="02010102" text="阿迪达斯/ADIDAS" />
<four value="02010103" text="彪马/PUMA" />
</three>
<three value="02010200" text="运动休闲鞋">
<four value="02010201" text="男子休闲鞋" />
<four value="02010202" text="女子休闲鞋" />
<four value="02010203" text="运动凉/拖鞋" />
</three>
<three value="02010300" text="台球" />
</two>
<two value="02020000" text="天文/野营望远镜">
<three value="02020100" text="双筒望远镜" />
<three value="02020200" text="天文望远镜设备" />
<three value="02020300" text="单筒望远镜" />
</two>
</one>
</category>
</FAQ>