次のエージェントは origXML ファイルを解析し、解析エラーを表示します。
Sub Initialize
Dim session As New NotesSession
Dim inputStream As NotesStream
Dim outputstream As Notesstream
Dim domParser As NotesDOMParser
Dim foundError As Boolean
Dim origXML As String
On Error Goto errh
Dim voption(2) As String
voption(VALIDATE_NEVER) = "VALIDATE_NEVER"
voption(VALIDATE_ALWAYS) = "VALIDATE_ALWAYS"
voption(VALIDATE_AUTO) = "VALIDATE_AUTO"
origXML = "c:¥dxl¥XMLvalid.xml"
foundError = False
Set inputStream = session.CreateStream
inputStream.Open (origXML)
If inputStream.Bytes = 0 Then
foundError = True
Messagebox "XML file "+ origXML+" is empty"
Goto report
End If
Set domParser=session.CreateDOMParser(inputStream, outputStream)
domParser.LogComment = "DOM Parser Report - Input validation"
domParser.InputValidationOption = VALIDATE_NEVER
domParser.Process
report:
If Not foundError Then Messagebox "Validation option " _
+voption(domParser.InputValidationOption)+" passed"
Exit Sub
errh:
foundError = True
Messagebox domParser.Log
Resume report
End Sub