Help with DXLImporter

Hi, I am using some sample code to generate an action hotspot in a richtext field using DXLimporter.

Here’s my code -

’ Build the DXL document including the hotspot in the Rich Text field

stream.WriteText{<?xml version="1.0" encoding="utf-8" ?>

 <item name='Display'>

  <richtext>

   <par>

The following MWG Policy Manuals exist:

MWG Quality Assurance Manual

Use “Navigation”

Sub Click(Source As Button) Call LaunchWorkspaceDocument(“MWGQuality”) End Sub

  </richtext>

 </item>

}

The hotspot is getting created correctly, but the problem is that the Lotusscript code that goes in the hotspot is being put in the Declarations section instead of OPtions and Sub Click event as specified in the above code.

What am i doing wrong?

Thanks.

Subject: Try this…

Introduce some white space around your LS code, e.g. change this

Sub Click(Source As Button) Call LaunchWorkspaceDocument(“MWGQuality”) End Sub

to this

Sub Click(Source As Button)

REM Call LaunchWorkspaceDocument("MWGQuality")

End Sub

I think that perhaps the way that we assemble the LS code together is getting confused without the extra white space. Not sure though.

Subject: Help with DXLImporter

I don’t have an answer for you, but I’m curious as to how this works in its entirety - I’ve never worked with DXLImport before, so I copied your code and tried to add it to a sample from the Designer Help, but I keep getting an error about unexpected string constant.

Would you mind posting your entire agent code?

Subject: RE: Help with DXLImporter

Here’s the complete code for the function

Function CreateNewHotspot(s As NotesSession, ws As NotesUIWorkspace, this_db As NotesDatabase, strDBTitle As String) As NotesDocument

' Purpose: Build a document using DXL and import into the current database and return the new document



On Error Goto ErrorHandler





Set stream = s.CreateStream

’ Build the DXL document including the button in the Rich Text field

stream.WriteText{<?xml version="1.0" encoding="utf-8" ?> 

The following MWG Policy Manuals exist:

MWG Quality Assurance Manual

Use “Navigation”

Sub Click(Source As Button) Call LaunchWorkspaceDocument(“MWGQuality”) End Sub

}

’ Import new document with button into current database

Set dmp = s.CreateDXLImporter(stream, this_db)

dmp.DocumentImportOption = DXLIMPORTOPTION_CREATE

dmp.Process

’ Get the NoteID of the newly created document

tmpNoteID = dmp.GetFirstImportedNoteID( )

’ Get the document by the NoteID and return it

Set newdoc = this_db.GetDocumentByID(tmpNoteID)

If Not (newdoc Is Nothing) Then

	Set CreateNewHotspot = newdoc

Else

	Messagebox "New document could not be found.", 0, "ERROR"

End If



Exit Function

ErrorHandler:

’ If there’s a problem processing the DXL, you will be prompted with the Row and Column

Msgbox dmp.Log



Print Lsi_info(2) + " - Error #" & Format$(Err) & " at line " & Format$(Erl) & ": " & Error$

Messagebox Lsi_info(2) + " - Error #" & Format$(Err) & " at line " & Format$(Erl) & ": " & Error$, 0, "Error"

Exit Function

End Function

Just call this function from the agent.

Anyone have any idea about my issue? Help needed!