CreateDXLIMporter with update option

I don’t understand what’s wrong with the code below.I use it on a local db, from a view-action button.

If I comment out the documentImportOption, a new doc is created correctly, but I want to update the selected document.

DXL is rather new to me, could anybody point me in the correct direction? Or give some sample code?

I did search the forum, but didn’t get it to work.

Thanks in advance !

Code in action button :

Sub Click(Source As Button)

Dim session As New NotesSession

Dim dc As notesdocumentcollection	

Dim db As NotesDatabase

Dim stream As NotesStream

Dim dmp As NotesDXLImporter



'init

Set db = session.CurrentDatabase

Set dc = db.UnprocessedDocuments

Set doc = dc.GetFirstDocument

Set stream = session.CreateStream



'build

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

<database xmlns="http://www.lotus.com/dxl" version="1.01">

	<databaseinfo replicaid="} + db.ReplicaID+{"/>

		<document form="JournalEntry">

                 <item name='Subject'><text>DXL demo</text></item>

                <item name='Body'>

                     <richtext>

                          <par>

                               <actionhotspot hotspotstyle="border">

							<code event="click">

								  <formula>@DialogBox("dbTest"; [AutoHorzFit] : [AutoVertFit] )</formula> 

							  </code>

							  a1 

					  </actionhotspot>

                          </par>

                     </richtext>

                </item>

           </document>

  </database>}



'import

Set dmp = session.CreateDXLIMporter(stream, db)

dmp.DocumentImportOption = DXLIMPORTOPTION_UPDATE_ELSE_CREATE

dmp.Process

End Sub

Subject: Solution : CreateDXLIMporter with update option

I just found the solution.It’s something I tried before, but I misplaced the line.

Just add this line of code between the document-tag and item-tag :