Examples: CreateDXLExporter method

This agent generates DXL from a note collection based on the content of the current database.

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Set db = session.CurrentDatabase
  
  REM Open xml file named after current database
  Dim stream As NotesStream
  Set stream = session.CreateStream
  filename$ = "c:\dxl\" & Left(db.FileName, Len(db.FileName) - 3) & _
  "xml"
  If Not stream.Open(filename$) Then
    Messagebox "Cannot open " & filename$,, "Error"
    Exit Sub
  End If
  Call stream.Truncate
  
  REM Create note collection for current database
  Dim nc As NotesNoteCollection
  Set nc = db.CreateNoteCollection(False)
  Call nc.SelectAllDesignElements(4)
  Call nc.BuildCollection
  
  REM Export note collection as DXL
  Dim exporter As NotesDXLExporter
  Set exporter = session.CreateDXLExporter(nc, stream)
  Call exporter.Process
End Sub