DXL importer question

Am I missing something or does the DXL importer only work for current database and Local databases? I’m attempting to import a copy of the Database Script code to multiple databases - this works fine for a Local replica of a db but doesn’t seem to work for the same database on a server.

I’ve found several code examples that either import to currentdatabase or create a new Local db and import to that.

The Designer help just says that the output for DXL importer is notesdatabase and doesn’t qualify where this can be.

Thanks

Dave

Subject: DXL importer question

Seems to be some thing to do with the DXL?

I’ve got an export agent that uses the DBDesign Class from the sandbox to get a handle on the Database Script document and export this to a DXL file - this works fine.

I’ve got an import agent that is as simple as possible to import this to another db. This works fine if the db is Local but throws a DXLImporter error (the log says: “<?xml version='1.0'?>Entry not found in indexDXL importer operation failed”) if the db is server based.

I’ve tried this with a replica of a blank db on Local and on a server, it imports properly on the Local db.

The code for the import agent is:

Sub Initialize

Dim session As New NotesSession

Dim dbdir As NotesDbDirectory

Dim db As NotesDatabase

Dim stream As NotesStream

Dim importer As NotesDXLImporter



Set stream = session.CreateStream

If Not stream.Open("c:\dxl\test1.dxl") Then

	Msgbox "Cannot open test1.dxl", , "Error"

	Exit Sub

End If

If stream.Bytes = 0 Then

	Msgbox "File did not exist or was empty", , FileName$

	Exit Sub

End If



Set db = session.CurrentDatabase

srvr$ = db.Server

Set db = New NotesDatabase(srvr$, "migration\CodeSt.nsf") 

If Not db.IsOpen Then Exit Sub



Set importer = session.CreateDXLImporter

importer.ReplaceDBProperties = False

importer.ReplicaRequiredForReplaceOrUpdate = False

importer.ACLImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE

importer.DesignImportOption = DXLIMPORTOPTION_REPLACE_ELSE_CREATE

Call importer.Import(stream, db)



Call stream.Close

End Sub

and the (really simple) DXL file I’m trying to import is:

<?xml version='1.0' encoding='utf-8'?>

<databasescript xmlns=‘http://www.lotus.com/dxl’ version=‘6.5’ maintenanceversion=‘3.0’

replicaid=‘802570F5003CE7DB’>

20060113T112033,87+00

20060113T142230,79+00

20060113T142230,78+00

20060113T142230,78+00

20060113T112050,37+00

CN=xxxxxx/O=xxx/name>

CN=xxxxxx/O=xxx<lotusscript

Sub Postopen(Source As Notesuidatabase)

Dim s As New NotesSession

Msgbox "yipee"

End Sub

(I’ve xxx’d out the name above for this post).

Any ideas?

Subject: DXL importer question

I have no problem with this operatios.

Check the target db(s) ACL.

HTH

Don

Subject: Elaborating

Here’s code I use all the time to version certain code or entire databases - whatever I’ve exported - to a code store (on the server)

Dim session As New NotesSession

  Dim dbdir As NotesDbDirectory

  Dim db As NotesDatabase

  Dim stream As NotesStream

  Dim importer As NotesDXLImporter



  Set stream = session.CreateStream

  If Not stream.Open("c:\dxl\exporteddb.dxl") Then

        Msgbox "Cannot open names.dxl", , "Error"

        Exit Sub

  End If

  If stream.Bytes = 0 Then

        Msgbox "File did not exist or was empty", , FileName$

        Exit Sub

  End If



  'current database is "BP\BP"

  Set db = session.CurrentDatabase

  srvr$ = db.Server

  Set db = New NotesDatabase(srvr$, "BP\BPCodeSt.nsf") ' backup design

archive

  If Not db.IsOpen Then Exit Sub

REM Import DXL into new database

  Set importer = session.CreateDXLImporter

  importer.ReplaceDBProperties = False

  importer.ReplicaRequiredForReplaceOrUpdate = False

  importer.ACLImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE

  importer.DesignImportOption = DXLIMPORTOPTION_REPLACE_ELSE_CREATE

  Call importer.Import(stream, db)



  Call stream.Close

works just fine for both design and data

HTH

Don

Subject: DXL importer question

PS - I’m attempting to use DXL to modify the Database script because I drew a blank trying to save this “document” back to the db. I can access and modify it using the DBDesign class but if I try to resave it saves as a document, not the Database Script (even though all the items and flags appear correct through Notespeek).

If anyone has managed to programatically modify this script can you please let me know.

Thanks Dave