如何在ASP中用XML??(20分)

  • 主题发起人 主题发起人 xfl
  • 开始时间 开始时间
X

xfl

Unregistered / Unconfirmed
GUEST, unregistred user!
好像xml必须用在后缀为xml的文件中,如何在asp中用XML呢??
 
response.write RecordsetToXML (rs, "table",pageno,21)
Response.ContentType="text/xml"
sub.asp
Function RecordsetToXML (oRec, sName,Pageno,pagesize)
Dim oFld
Dim sXML
Dim sSpaces
Dim sNames
Dim RecNo
dim sConvert
sSpaces = Space (iLevel * 2)
If Right(sName, 1) = "S" then
sNames = sName
sName = Left (sName, Len(sName) - 1)
else
sNames = sName &
"S"
End If
sXML = sSpaces &
"<" &amp;
sNames &amp;
">" &amp;
vbCR
iLevel = iLevel + 1
sSpaces = Space (iLevel * 2)
oRec.MoveFirst
RecNo=(Pageno-1)*Pagesize
oRec.move(RecNo)
For intRecord = 1 To PageSize
RecNo=RecNo+1
sXML = sXML &amp;
sSpaces &amp;
"<" &amp;
sName &amp;
">" &amp;
vbCR
sXML = sXML &amp;
sSpaces &amp;
" <idno>" &amp;left("........",len(pageno*pagesize)-len(RecNo))&amp;RecNo &amp;
"</idno>" &amp;
vbCR
For Each oFld In oRec.Fields
If oFld.Type = adChapter then
Set oChapter = oFld.Value
If Not oChapter.EOF then
iLevel = iLevel + 1
sXML = sXML &amp;
RecordsetToXML (oChapter, oFld.Name)
iLevel = ilevel - 1
End If
else
sXML = sXML &amp;
sSpaces &amp;
" " &amp;
"<" &amp;
oFld.Name &amp;
">" &amp;
oFld.Value &amp;
"</" &amp;
oFld.Name &amp;
">" &amp;
vbCR
End If
Next
sXML = sXML &amp;
sSpaces &amp;
"</" &amp;
sName &amp;
">" &amp;
vbCR
oRec.MoveNext
If oRec.EOF then
Exit For
Next
iLevel = iLevel - 1
sSpaces = Space (iLevel * 2)
sXML = sXML &amp;
sSpaces &amp;
"</" &amp;
sNames &amp;
">" &amp;
vbCR
RecordsetToXML = sXML
End Function
 
老兄上面的东东我看不懂!
请指教!
 
能否简单一点?
只是说一下,如何使用XML
 
使用xml有两种方法:html的嵌入;activex中的引用。比较简单。我的毕业论文是有关xml的有
什么问题再讨论
 
html的嵌入如何实现?
我在ASp中按照插入HTML的方法那么不行?
请指教
 
<a href=/delphi/attachments/xml.doc>《实战XML》</a>
(已经被《电子与电脑》录用了)
 
我也是初学xml的,它是一种数据表达形式(相当于某一格式的数据库文件),没有表现形式,
因此在IE中只能看到它的数据的树形结构。在chinaasp里有它的基本资料。有兴趣咱们一块
学,欢迎这方面的高手多指教
oicq: 5612458
e-mail: liusong1111@263.net
 
多人接受答案了。
 
后退
顶部