Usability - Productivity - Business - The web - Singapore & Twins

<strike>I need a</strike> DXL/XML guru&apos;s advise!

I'm working on a project, that will reunite a bunch of databases that once were one back into a common template. One tool that worked very well is DXL export, XSLT transformation and importing that stuff back. I'm using the Body field of a Notes document to store the DXL, which creates some kind of documentation/audit trail. This morning we hit the wall.
I exported a rather complex form (a lot of subforms, multi-nested tables, hotspots and a lot of fields). When I tried to reimport the DXL untouched I was greeted with this error dialogue:

(For RSS readers: the message says: "Left margin cannot be greater than right margi". I did the msgbox, but that was the error in the DXL importer. Please note the typo/truncation. Anybody came across this and could advise what to do?

Update: I found a solution (and opened another can of worms)! The form I tried to export has quite a bit of "history" So in the table tag there is an attribute r4spacing="true". With this attribute set I get the error message. The attribute tells the designer to use the fixed values provided in refwidth="10.4778in". Once you remove the attribute "r4spacing" import works. Of course now the table rendering follows a different rule set, so it gets all messed up. Looks like another session in XSLT to clean this up.

This is the agent we use for import:

Sub Initialize
    'Exports DXL design elements from the base line code into a
    'database. Can be new, might exist

    Dim db As NotesDatabase
    Dim dCol As NotesDocumentCollection
    Dim newDB As NotesDatabase
    Dim doc As NotesDocument
    Dim rt As NotesRichTextItem
    Dim txtServerName As String
    Dim txtNewDBName As String

    Dim s As New NotesSession
    Set db = s.CurrentDatabase
    txtServerName = db.Server

    txtNewDBName = Inputbox("Create/Update db on "+txtServerName,"")
    If txtNewDBName = "" Then
             Exit Sub
    End If

    Set newDB = New NotesDatabase(txtServerName,txtNewDBName)
    If Not newDB.IsOpen Then
             'We need to create it!
             Call newDB.Create(txtServerName,txtNewDBName,True)
             If Msgbox("This DB does exist, update it? (Exisiting elements will be overwritten)",36) <> 6 Then
                     Exit Sub
             End If

    End If

    'Final check
    If Not newDB.IsOpen Then
             'Something went wrong!
             Msgbox"Can't open the selected database, I'm sorry!"
             Exit Sub
    End If

    Set dCol = db.UnprocessedDocuments
    Set doc = dCol.GetFirstDocument

    Do Until doc Is Nothing
             If doc.HasItem("Body") Then
                     Set rt = doc.GetFirstItem("Body")
                     If doc.HasItem("Subject") Then
                              Print "Working on " & doc.subject(0)
                     End If
                     Call ImportDXLfromRT(rt,newDB)
             End If
             Set doc = dCol.GetNextDocument(doc)

End Sub

Sub ImportDXLfromRT(rt As NotesRichTextItem, db As NotesDatabase)
Dim dxi As NotesDXLImporter

    On Error Goto Err_ImportDXLfromRT

    Dim s As New NotesSession
    Set dxi = s.CreateDXLImporter

    'Set the import to ONLY import design elements
    dxi.DocumentImportOption = DXLIMPORTOPTION_IGNORE
    dxi.ReplaceDBProperties = False
    dxi.ReplicaRequiredForReplaceOrUpdate = False

    'Set the source to RT and the target to the db
    Call dxi.setInput(rt)
    Call dxi.setOutput(db)
    Call dxi.process

Exit Sub

'Error from dxi
Print Error$

End Sub

As usual YMMV

Posted by on 05 July 2005 | Comments (1) | categories: IBM Notes Lotus Notes


  1. posted by null on Tuesday 25 March 2008 AD:
    Emoticon wink.gif