ASP生成XML的问题,版主请进!
<!--#include file="date/conn.asp"--><%
strC = "<?xml version=""1.0"" encoding=""utf-8""?> " & vbcrlf
strC = strC&"<settings totalWidth=""650"" playerWidth=""420"" playerHeight=""300"" slideTime=""5"" titleBack=""0x000000"" titleText=""0xffffff"" navButtonsBack=""0x000000"" navButtonsText=""0xffffff"" videoBack=""0x000000"" videoButtons=""0xffffff"" videoButtonsRoll=""0xf129b0"" videoSeekBack=""0xffffff"" videoSeekBuffered=""0xfcd8f3"" videoSeekPlayed=""0xf129b0"" videoSeekHandle=""0x000000"" videoCurrentTime=""0xffffff"" videoTotalTime=""0xf129b0"">" & vbcrlf
strC = strC&"<folio>"& vbcrlf
set rs = server.CreateObject("adodb.recordset")
sql="select * from pro where bclass=87 and sclass=88 order by id desc"
rs.open sql,conn,1,1
do while not rs.eof
strC = strC&"<project>"& vbcrlf
strC = strC&"<title><![CDATA["&rs("nam")&"]]></title>"& vbcrlf
strC = strC&"<description><![CDATA["&rs("content")&"]]></description>"& vbcrlf
strC = strC&"<assets type=""photo"">"& vbcrlf
strC = strC&"<item src='"&rs("pica")&"' />"& vbcrlf
strC = strC&"<item src='"&rs("picb")&"' />"& vbcrlf
strC = strC&"<item src='"&rs("picc")&"' />"& vbcrlf
strC = strC&"<item src='"&rs("picd")&"' />"& vbcrlf
strC = strC&"<item src='"&rs("pice")&"' />"& vbcrlf
strC = strC&"<item src='"&rs("picf")&"' />"& vbcrlf
strC = strC&"<item src='"&rs("picg")&"' />"& vbcrlf
strC = strC&"<item src='"&rs("pich")&"' />"& vbcrlf
strC = strC&"</project>"& vbcrlf
rs.movenext
loop
rs.close
strC = strC&"</folio>"& vbcrlf
strC = strC&" </settings>" & vbcrlf
call saveXml(strC,"folio_rp_settings.xml")
Function saveXml(Text,FileName)
dim xmldoc,path
set xmldoc= server.CreateObject("MSXML.DOMDocument")
path = Server.MapPath(FileName)
xmldoc.LoadXML(Text)
xmldoc.save(path)
set xmldoc= nothing
End Function
%>
以上代码是用FSO生成xml
生成的的格式如下
<?xml version="1.0" encoding="utf-8"?>
<settings totalWidth="650" playerWidth="420" playerHeight="300" slideTime="5" titleBack="0x000000" titleText="0xffffff" navButtonsBack="0x000000" navButtonsText="0xffffff" videoBack="0x000000" videoButtons="0xffffff" videoButtonsRoll="0xf129b0" videoSeekBack="0xffffff" videoSeekBuffered="0xfcd8f3" videoSeekPlayed="0xf129b0" videoSeekHandle="0x000000" videoCurrentTime="0xffffff" videoTotalTime="0xf129b0">
<folio>
<project>
<title><![CDATA[test]]></title>
<description><![CDATA[1111]]></description>
<assets type="photo">
<item src="UploadFiles/2009121621264316931.jpg"/>
<item src="UploadFiles/2009121621264714641.jpg"/>
<item src="UploadFiles/2009121621265115831.jpg"/>
<item src="UploadFiles/2009121621265612641.jpg"/>
<item src="UploadFiles/200912162127610141.jpg"/>
<item src="UploadFiles/200912162127610141.jpg"/>
<item src=""/>
<item src=""/>
</assets>
</project>
</folio>
</settings>
红色部分是数据库该字段为空的结果,我想当字段为空的时候可不可以让该节点不显示,就是有几张图片显示几个节点。
希望高手指教
最好给我修改的代码,本人初学者,谢谢大家!