Unmodified output from NotesDXLExporter causes error in NotesDXLImporter

Hi everyone,

I kept getting errors with NotesDXLImporter. I am using it to update a document in a Notes database, like this;

  1. Select a Notes document in a database

  2. doc → NotesDXLExporter → NotesDOMParser

  3. Add and remove some nodes in the DOMParser document

  4. DOMParser.Serialize() → NotesStream → NotesDXLImporter → doc

(The reason for using the DXL methods is that I have had awful bother with NotesEmbeddedObject.Remove(), so I am trying to use the DXL methods to achieve the same end.)

Just as an experiment I dropped step 3. So now I just export the document into NotesDOMParser, then import it straight back without changing anything. I am still getting the same error in NotesDXLImporter.

The only thing I can think of is that the NotesStream in step 4 needs to be set to a particular character set, but I cannot figure out the one to choose. Does anyone have a suggestion?

Here is the relevant part of my testing code;

Private Function DeleteAttachments( docFrom As NotesDocument ) As Boolean

Dim as New NotesSession

Dim DOMParser As NotesDOMParser

Dim DXLExporter As NotesDXLExporter



Set DOMParser = s.CreateDOMParser()

Set DXLExporter = s.CreateDXLExporter( docFrom, DOMParser )

Call DXLExporter.Process()

’ TEST just push the DXL straight back again to see if we get errors

Dim dxlstream As NotesStream

Dim DXLImporter As NotesDXLImporter



Set dxlstream = s.CreateStream()

Call DOMParser.Setoutput( dxlstream )

Call DOMParser.Serialize()

Set DXLImporter = s.CreateDXLImporter( dxlstream, docFrom.ParentDatabase )

DXLImporter.DocumentImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE

Call DXLImporter.Process()	    '  <== ERROR HERE

Immediately before the failure, the properties of the NotesStream are;

charset: x-lmbcs

bytes: 14784530

The Notes document is a big one with attachments and embedded graphics, but no embedded OLE objects

Here is NotesDXLImporter.Log;

<?xml version='1.0'?>

Encoding (utf-16, from XMLDecl or manually set) contradicts the auto-sensed encoding, ignoring it

Expected end of tag ‘run’

Unknown DXL class library error

DXL importer operation failed

I have the Notes 6.5.2 client, running on Windows XP.

Thank you for any advice (I hope this is crispy enough!), best wishes, Ian

Subject: RE: Unmodified output from NotesDXLExporter causes error in NotesDXLImporter

It would be interesting to see what’s in the XML at the line and character position mentioned in the message – and whether it’s right about complaining of a missing . Why don’t you stream the data to a file instead, and see whether it’s valid XML?

I don’t think your character set is the problem, but as a test, again, you could try getting the text out of the stream, then create a new stream and put the text in it – it will use the default unicode encoding, which shouldn’t present a problem.

Do you have any characters in the document that might be different in utf-16 and lmbcs?

What’s the problem, exactly, with the embeddedobject methods?

Is it an option to try this with a later version?

Subject: RE: Unmodified output from NotesDXLExporter causes error in NotesDXLImporter

Hi Andre,

Thank you for your response. Here are some answers;

  1. Why don’t you stream the data to a file instead, and see whether it’s valid XML?

I was unable to include the offending bit of XML in my posting. However, a colleague parsed the XML file for me using XMLSpy, and it reported no missing tags. So, it looks as though the XML itself is fine, and it’s the NotesDXLImporter which is getting confused.

  1. you could try getting the text out of the stream, then create a new stream and put the text in it

I had not thought of this and will try it…

  1. Do you have any characters in the document that might be different in utf-16 and lmbcs?

I don’t know! The documents and their attachments are all in English. The attachments in the document are made with Acrobat, Powerpoint, Word or Excel. The embedded graphics in the document were also made with these products. I don’t know whether utf-16 versus x-lmbcs affect the way that binary data is included in the DXL.

  1. What’s the problem, exactly, with the embeddedobject methods?

After NotesEmbeddedObject.Remove(), a proportion of documents are left in an unreadable state and can no longer be opened. The error message is “Ignoring portion of document which was modified with a later version of Notes”. There are lots of comments about this on the forum, and I implemented all the suggested fixes I could find. The fixes solved the problem in most cases, but there is still a proportion of documents that get corrupted.

  1. Is it an option to try this with a later version?

I tried this with a Notes 8 client (Notes 6.5.2 is our company standard) and got exactly the same error

I am on the point of abandoning my efforts on this. Apparently IBM has a product called CommonStore which might be able to do the job - remove the attachments, store them somewhere else, and maintain links to them. MIDAS would a be a possibility too but it is “not company policy” to use it unfortunately.

I still welcome any ideas about this! Best wishes, Ian

Subject: NotesDXLImporter errors: found ANSWER here

Hi folks,

I found this invaluable entry by Kenneth Haggman…

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/0522a49a05e1a3198525737e00517a1f?OpenDocument

It describes three workarounds. In my case, it’s the 3rd one that does the trick. Basically you look for [ and ] characters in the DXL, and replace them with explicit ASCII codes.

When I tried this, the documents that were failing to be imported started to work correctly.

The documents contain one readers field and the readers filed has a role in it, like “[DbAdmin]”. Kenneth’s fix changes this to “&_#91;DbAdmin&#_93;” (without the underscores, which I added just so that this bulletin board shows the codes without translating them back into [ and ] ).

I will do a more extensive test but I am feeling very encouraged! Thansks kenneth for your very helpful post. I now owe you a big favour.

best wishes, Ian