Subject: RE: change links using NotesDXLExporter and NotesDXLImporter
Thanks for the help Christopher, but I don’t think this code will work for what I need to do. I have to change the href attribute of a hotspot, and not just text in a document.
I already got the next code working correct:
REM **** INITIALIZE LOCAL ERROR HANDLER
On Error Goto ErrorHandler
ProcessDatabase = False
REM **** DECLARE LOCAL VARIABLES
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim exporter As NotesDXLExporter
Dim importer As NotesDXLImporter
Dim parser As NotesDOMParser
Dim node As NotesDOMDocumentNode
Dim nodelist As NotesDOMNodeList
Dim linknode As NotesDOMElementNode
Dim i As Long
Dim x As Integer
Dim intCount As Integer
Dim strLink As String
Dim boolLogIt As Boolean
Dim exportSucceeded As Boolean
REM **** DEFINE DOM OBJECTS
Set exporter = session.CreateDXLExporter
Set parser = session.CreateDOMParser
REM **** START OF DATABASE TO BE PROCESSED
Call agentLog.LogAction("ProcessDatabase: Processing database " & db.Title)
REM **** WALK THROUGH ALL DOCUMENTS IN THE DATABASE
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
Do While Not doc Is Nothing
intCount = 0
strHREFs = “”
boolLogIt = False
REM ***** TRANSFORM DOCUMENT TO DXL AND WALK THROUGH LINKS TO LOOKUP REFERENCES TO NETWORK DRIVES
Call exporter.SetInput(doc)
Call exporter.SetOutput(parser)
exporter.ExitOnFirstFatalError = False
exportSucceeded = False
Call exporter.Process
exportSucceeded = True
Set node = parser.Document
Set nodelist = node.GetElementsByTagName(“urllink”)
If nodelist.NumberOfEntries <> 0 Then
For i = 1 To nodelist.NumberOfEntries
Set linknode = nodelist.GetItem(i)
strLink = linknode.GetAttribute("href") 'retrieve text from the url
For x=0 To Ubound(oldLinks) 'compare paths to replace to retrieved link and see if we encounter a link to replace
If Instr(strLink, oldLinks(x)) <> 0 Then
intCount = intCount + 1
newLink = ReplaceSubstring(strLink, oldLinks(x), newLinks(x))
boolLogIt = True
End If
Next
Next
End If
With this code I can already detect if and which urllinks schould be changed. But it’s the import back to the Notesdocument that doesn’t succeed.
Who can help me?
Thanks in advance!