Good Day all,
It’s been years since I touched LS or Domino really (I do miss it).
I have been asked to export some Notes documents to XML for migration to another system. (sad I know)
Anyway, I am using the NotesDXLExporter and with a simple script am able to produce XML files for the documents (they want each document as a separate XML file).
Here is the code:
Option Public
Option Explicit
Dim filename As String
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim col As NotesDocumentCollection
Dim exporter As NotesDXLExporter
Dim doc As NotesDocument
Dim vw As NotesView
Dim sPath As String
Dim count As integer
Set db = s.CurrentDatabase
Set col = db.UnprocessedDocuments
If col.Count = 0 Then
MessageBox "No document selected",, "No document"
Exit Sub
End If
Set doc = col.GetFirstDocument
While Not (doc Is Nothing)
count = count +1
Dim stream As NotesStream
Set stream = s.CreateStream
sPath = "c:\CMD\Export\"
filename$ = sPath & doc.UniversalID & "dxl"
If Not stream.Open(filename$) Then
MessageBox "Cannot open " & filename$,, "Error"
Exit Sub
End If
Set stream = s.CreateStream
Call stream.Open(filename$)
Call stream.Truncate
Set exporter = s.CreateDXLExporter
exporter.ConvertNotesBitmapsToGIF = true
Call exporter.SetInput(doc)
Call exporter.SetOutput(stream)
Call exporter.Process
Call stream.Close
Set doc = col.GetNextDocument(doc)
Print "Processing: " & CStr(count)& " of " & CStr(col.count)
wend
Exit Sub
End Sub
For some reason the exported XML uses single quotes instead of double quotes for all the item names (fields) and in many other places. I am not an XML expert but I thought these should be enclosed in double quotes for properly formatted XML. I also have some lines which appear to wrap and break the end tags also causing malformatted XML.
I included a little bit of the output (header and item) for you to see:
<?xml version='1.0' encoding='utf-8'?><document xmlns=‘http://www.lotus.com/dxl’ version=‘9.0’ maintenanceversion=‘1.0’
replicaid=‘86257E7A00546DD4’ form=‘Main Topic’>
.
.
.
.
In Progress
.
.
Any assistance is much appreciated
Cheers,
Mark
PS. This output is from my designer 9.0.1 client but I also tried with 8.5.2 and 8.5.3 with the same result