@TOC## 标题
LotusScript获取XML具体节点值
Sub Initialize
Set session = New NotesSession
Dim XMLProcessor As NotesDOMParser
Dim root As NotesDOMDocumentNode
Dim nodelist As NotesDOMNodeList
Dim nodevalList List As String
Dim XMLstr As String
If xmlStr<> "" Then
Set XMLprocessor = session.Createdomparser(XMLstr)
Call XMLProcessor.Process()
Set root = XMLProcessor.Document
nodevalList("字段名1") = GetNodeValue(root,"字段名1")
nodevalList("字段名2") = GetNodeValue(root,"字段名2")
msgbox nodevalList("字段名1")
end if
end sub
'GenNodeValue函数
Function GetNodeValue(node As NotesDOMDocumentNode,tagName As String) As String
On Error GoTo errhandle
Dim nodelist As NotesDOMNodeList
Dim elementNode,textNode As NotesDOMNode
Set nodelist = node.GetElementsByTagName(tagName)
If nodelist.Numberofentries <>0 Then
Set elementNode = nodelist.Getitem(1)
If Not elementNode.isnull Then
Set textNode = elementNode.FirstChild
If Not textNode.isNull Then
GetNodeValue = textNode.Nodevalue
Else
GetNodeValue = ""
End If
End If
End If
Exit Function
errhandle:
MsgBox "GetNodeValue函数第" & Erl & "行产生错误:" & Error
Exit Function
End Function