Article: Domino DXLManager »
FERDY CHRISTANT - NOV 26, 2004 (05:20:39 PM)
Introduction
Ever since Notes & Domino 6 was released, developers have had the possibility to use an incredibly powerful feature: DXL. DXL enables developers to convert Domino notes, such as design elements and documents, to an XML format and vice versa. Domino leverages parser classes and import/export classes to facilitate this feature. Additionally, it is possible in the Domino Designer Client to export design elements to the DXL format. Unfortunately, there is no import function.
This short article describes a class I've written a while ago that has helped me manage the importing and exporting of DXL. Before we dive into the class, it is important to consider the endless possibilities of being able to import/export notes, especially design elements:
- Export (part of) the design of an application and publish the synopsis in your own desired format.
- Export (part of) the design of an application and thoroughly analyze it, by simply parsing the XML.
- Export (part of) the design of an application, do a search and replace, and import the modified result back in the database.
- Export (part of) the design of an application and do a bulk change on many design elements, and import the modified result back in the database.
- Export your favorite components to DXL files and then dynamically generate a new application simply by selecting the desired components to use.
- Design your application in a tool other than the Designer Client. As long as the output is in DXL format, Domino can handle it.
The list goes on. Imagine the possibilities, the time you can save, the ways you can think of to automate your common tasks.
The DXLManager class
The basis of pretty much every DXL transaction is either an import or export. Notes & Domino 6 have dedicated classes to do this. The DXLManager class, however, makes it even more easy to perform these tasks. It is a simple, yet powerfull class that acts as an enabler for more advanced DXL processing.
The DXLManager class only has three public methods. They are:
Exporting DXL
| Method signature | |
|---|---|
| exportDXL(dbInput As NotesDatabase, sOutput As String, boolDesign As Boolean, boolDoc As Boolean, boolAdmin As Boolean) | |
| Description | |
| Exports notes from a NotesDatabase to a DXL file you specify. You can pass the type of notes you would like to export. | |
| Parameter | Description |
| dbInput | NotesDatabase handle to export notes from |
| sOutput | String that holds the file location to use for storing the export output. |
| boolDesign | Boolean flag that determines whether or not to export design notes. |
| boolDoc | Boolean flag that determines whether or not to export doc notes. |
| boolAdmin | Boolean flag that determines whether or not to export admin notes. |
| Code example | |
|
'export current database to a DXL file, design notes only. 'options Use "LS_DXLManager" 'declarations Dim sesCurrent as NotesSession Dim dbCurrent as NotesDatabase Dim objDM as DXLManager Dim strExportFile as String 'initialize Set sesCurrent = New NotesSession Set dbCurrent = sesCurrent.CurrentDatabase strExportFile = "c:\dump.dxl" Set objDM = New DXLManager() Call objDM.exportDXL(dbCurrent, strExportFile, true, false, false ) | |
Importing DXL
| Method signature | |
|---|---|
| Public Sub importDXL(sInput As String, dbOutput As NotesDatabase, boolDesign As Boolean, boolDoc As Boolean, boolAdmin As Boolean) | |
| Description | |
| Imports the notes contained in a DXL file into a specified database. The database will automatically be signed with the current ID after the operation. You can pass the type of notes you would like to import. | |
| Parameter | Description |
| sInput | String that holds the file location of the DXL file to import. |
| dbOutput | NotesDatabase handle to import DXL into. |
| boolDesign | Boolean flag that determines whether or not to import design notes. |
| boolDoc | Boolean flag that determines whether or not to import doc notes. |
| boolAdmin | Boolean flag that determines whether or not to import admin notes. |
| Code example | |
|
'import DXL into the current database, design notes only. 'options Use "LS_DXLManager" 'declarations Dim sesCurrent as NotesSession Dim dbCurrent as NotesDatabase Dim objDM as DXLManager Dim strImportFile as String 'initialize Set sesCurrent = New NotesSession Set dbCurrent = sesCurrent.CurrentDatabase strImportFile = "c:\source.dxl" Set objDM = New DXLManager() Call objDM.importDXL(strImportFile, dbCurrent, true, false, false ) | |
Assembling DXL
| Method signature | |
|---|---|
| Public Sub assembleDXL(vFileNames As Variant, dbOutput As NotesDatabase, boolDesign As Boolean, boolDoc As Boolean, boolAdmin As Boolean) | |
| Description | |
| Assembles a number of DXL files into a NotesDatabase you specificy. The database will automatically be signed with the current ID after the operation. You can pass the type of notes you would like to import. | |
| Parameter | Description |
| vFileNames | Array of files names that holds the locations of the DXL files to import. |
| dbOutput | NotesDatabase handle to import DXL into. |
| boolDesign | Boolean flag that determines whether or not to import design notes. |
| boolDoc | Boolean flag that determines whether or not to import doc notes. |
| boolAdmin | Boolean flag that determines whether or not to import admin notes. |
| Code example | |
|
'import multiple DXL files into the current database, design notes only. 'options Use "LS_DXLManager" 'declarations Dim sesCurrent as NotesSession Dim dbCurrent as NotesDatabase Dim objDM as DXLManager Dim arrFiles(0 to 2) as String 'initialize Set sesCurrent = New NotesSession Set dbCurrent = sesCurrent.CurrentDatabase arrFiles(0) = "c:\source1.dxl" arrFiles(1) = "c:\source2.dxl" arrFiles(2) = "c:\source3.dxl" Set objDM = New DXLManager() Call objDM.assembleDXL(arrFiles, dbCurrent, true, false, false ) | |
Conclusion
The DXLManager is a simple helper class that makes it easy for you to do basic DXL import/export operations. You can download the class here. Simply import it into an empty script library and save it as "LS_DXLManager". Note that all of this only works in ND6 or higher.


Comments: 1
Reviews: 1
Average rating:
Highest rating: 5
Lowest rating: 5
COMMENT: JAKES

MAY 15, 08:42:38 PM
Great work!
However, I am running into an issue when I create a new database from the dxl file.
I get the following error:
Database is not full-text indexed
This causes the import operation to fail. I have searched the web for answers, but was not successful.
I cannot create an index for all databases that I copy the designs from. What is the workaround for this. What am I missing?
I thank you in anticipation.
Jakes «