Dec
16
Posted (Johan Känngård) in LotusScript, XML on 2005-12-16

So I don’t forget the next time I want to do this, and trust me, I got a short memory!

Dim xml As String
Dim rootElementNode As NotesDOMElementNode
xml = "YOUR XML HERE"
Set rootElementNode = parseXML(xml)._
getElementsByTagName("THE ROOTNODE").getItem(1)
Public Function parseXML(xml As String) _
As NotesDOMDocumentNode
  ' Parses the specified xml.
  On Error Goto catch
  Dim session As New NotesSession()
  Dim stream As NotesStream
  Set stream = session.createStream()
  Call stream.writeText(xml)
  Dim domparser As NotesDOMParser
  Set domparser = session.createDOMParser(stream)
  domParser.exitOnFirstFatalError = True
  Call domParser.parse()
  Set parseXML = domparser.Document
  Exit Function
catch:
  Error Err, _
Err & "|" & Error & "|" & Lsi_info(2) & ":" & Erl
End Function


Post a comment
Name: 
Email: 
URL: 
Comments: