写这种代理一定要注意容错性。不然一个地方出错,可能会影响整个XML文档的构。
BulidXML?openagent
用的时候:
var xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.load("bulidXML?openagent");
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set view = db.GetView("Tasks")
Set doc = view.GetFirstDocument
Print {Content-Type: text/xml}
Print {Cache-control: no-cache}
Print {<?xml version="1.0" encoding="GB2312"?>}
Print {<Tasks>}
While Not doc Is Nothing
Print {<task>}
Print {<username>}
Print doc.worker(0)
Print {</username>}
Print {<tasktitle>}
Print doc.tasktitle(0)
Print {</tasktitle>}
Print {<fileid>}
Print doc.UniversalID
Print {</fileid>}
Print {<content>}
Print doc.content
Print {</content>}
Print {<starttime>}
Print doc.starttime(0)
Print {</starttime>}
Print {<endtime>}
Print doc.endtime(0)
Print {</endtime>}
Print {<statu>}
Print doc.statu(0)
Print {</statu>}
Print {<hours>}
If Not doc.hours(0) = "" Then
Print doc.hours(0)
Else
Print "0"
End If
Print {</hours>}
Print {<leaders>}
If Not doc.leaders(0) = "" Then
Print doc.leaders(0)
Else
Print "未指定"
End If
Print {</leaders>}
Print {<pj>}
If Not doc.pingjia(0) = "" Then
Print doc.pingjia(0)
Else
Print "目前没有评价"
End If
Print {</pj>}
Print {</task>}
Set doc = view.GetNextDocument(doc)
Wend
Print {</Tasks>}
End Sub
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
博客强调构建XML文档代理时要注意容错性,避免一处出错影响整体。还给出了使用XML的代码示例,以及一段Sub过程代码用于生成包含任务信息的XML文档,设置了文档编码为GB2312。
337

被折叠的 条评论
为什么被折叠?



