为什么输出的 XML 文件里, 是空的?
我只是想将太长的标题截短来输出,但是它现在输出是空的,
<?xml version="1.0" encoding="gb2312" ?>
<News>
<Record>
<CurtTitle />
</Record>
</News>
请问怎么解决?
以下是:该 ASP 文件
<%@ Language=VBScript %>
<%set xmldoc=CreateObject("Microsoft.XMLDOM")%>
<%Response.ContentType="text/xml"%>
<?xml version="1.0" encoding="gb2312"?>
<%
maxlen="13"
Sub ShowField(strFieldName)
dim FieldMaxLen,strShow
FieldMaxLen = Cint(maxlen)
if strFieldName<>"" then
if len(strFieldName)<=FieldMaxLen then
strShow=strFieldName
else
strShow=left(strFieldName,FieldMaxLen) + "..."
end if
titlestr=strShow
end if
End Sub
set root=xmldoc.createnode("element","News","") '建立root对象
xmldoc.appendchild(root)
set news_record=xmldoc.createnode("element","Record","") '建立对象
root.appendchild(news_record) '建立节点
set curt_title=xmldoc.createnode("element","CurtTitle","")
news_record.appendchild(curt_title)
ShowField "有关B2B系统录入所填表格,域名注册,通用网址使用方法说明"
curt_title.text=titlestr
Response.Write xmldoc.xml '输出到客户端的XML
%>