
求一段asp修改xml的实例?
一下是pic.xml中的代码,怎样编写asp程序,读取数据库ADs表whereID>30中的Pic(图片路径)字段url(超链接)字段,填充到pic.xml中?<?xml...
一下是pic.xml中的代码,怎样编写asp程序,读取数据库ADs表 where ID>30
中的Pic(图片路径)字段 url(超链接)字段 ,填充到pic.xml中?
<?xml version='1.0' encoding='utf-8'?>
<imgList>
<pic>
<list path="../Upload/PicFiles/SYlunhuan1.jpg" smallpath="../images/small.png" smallinfo="ҳFlashһ">http://www.hao123.com</list>
<list path="../Upload/PicFiles/SYlunhuan2.jpg" smallpath="../images/small.png" smallinfo="ҳFlashһ">http://www.hao123.com</list>
<list path="../Upload/PicFiles/SYlunhuan3.jpg" smallpath="../images/small.png" smallinfo="ҳFlashһ">http://www.baidu.com</list>
<list path="../Upload/PicFiles/SYlunhuan4.jpg" smallpath="../images/small.png" smallinfo="ҳFlashһ">http://www.baidu.com</list>
<list path="../Upload/PicFiles/SYlunhuan5.jpg" smallpath="../images/small.png" smallinfo="ҳFlashһ">http://www.baidu.com</list>
</pic>
<rollTime fade_in="10">4</rollTime>
<text font="" size="12" bold="true" color="0xfffffff"></text>
</imgList> 展开
中的Pic(图片路径)字段 url(超链接)字段 ,填充到pic.xml中?
<?xml version='1.0' encoding='utf-8'?>
<imgList>
<pic>
<list path="../Upload/PicFiles/SYlunhuan1.jpg" smallpath="../images/small.png" smallinfo="ҳFlashһ">http://www.hao123.com</list>
<list path="../Upload/PicFiles/SYlunhuan2.jpg" smallpath="../images/small.png" smallinfo="ҳFlashһ">http://www.hao123.com</list>
<list path="../Upload/PicFiles/SYlunhuan3.jpg" smallpath="../images/small.png" smallinfo="ҳFlashһ">http://www.baidu.com</list>
<list path="../Upload/PicFiles/SYlunhuan4.jpg" smallpath="../images/small.png" smallinfo="ҳFlashһ">http://www.baidu.com</list>
<list path="../Upload/PicFiles/SYlunhuan5.jpg" smallpath="../images/small.png" smallinfo="ҳFlashһ">http://www.baidu.com</list>
</pic>
<rollTime fade_in="10">4</rollTime>
<text font="" size="12" bold="true" color="0xfffffff"></text>
</imgList> 展开
1个回答
展开全部
Content = "<?xml version='1.0' encoding='utf-8'?>" & vbCrLf
Content = Content &"<imgList>" & vbCrLf
Content = Content &"<pic>" & vbCrLf
sql="select * from [ADs] where ID>30 "
Set Rs=Conn.Execute(sql)
if not Rs.eof Then
do while not Rs.eof
Content = Content &"<list path="""& Rs("Pic") &""" smallpath="""& Rs("Pic") &""" smallinfo=""ҳFlashһ"">"& Rs("url") &"</list>" & vbCrLf
loop
end If
Rs.close
Set Rs = Nothing
Content = Content &"</pic>" & vbCrLf
Content = Content &"<rollTime fade_in=""10"">4</rollTime>" & vbCrLf
Content = Content &"<text font="""" size=""12"" bold=""true"" color=""0xfffffff""></text>" & vbCrLf
Content = Content &"</imgList> " & vbCrLf
filepath=server.mappath("./pic.xml")
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile(filepath)
MyFile.WriteLine Content
MyFile.close
Content = Content &"<imgList>" & vbCrLf
Content = Content &"<pic>" & vbCrLf
sql="select * from [ADs] where ID>30 "
Set Rs=Conn.Execute(sql)
if not Rs.eof Then
do while not Rs.eof
Content = Content &"<list path="""& Rs("Pic") &""" smallpath="""& Rs("Pic") &""" smallinfo=""ҳFlashһ"">"& Rs("url") &"</list>" & vbCrLf
loop
end If
Rs.close
Set Rs = Nothing
Content = Content &"</pic>" & vbCrLf
Content = Content &"<rollTime fade_in=""10"">4</rollTime>" & vbCrLf
Content = Content &"<text font="""" size=""12"" bold=""true"" color=""0xfffffff""></text>" & vbCrLf
Content = Content &"</imgList> " & vbCrLf
filepath=server.mappath("./pic.xml")
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile(filepath)
MyFile.WriteLine Content
MyFile.close
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询