NotesDXLExporter class and notesrichtextitem

Below is code from notes help…The exporter.SetInput(db) also take a notesrichtextitem as a parameter. Everytime I try to pass in this object, I get the following error? Any ideas?

Error = 4510 : DXLExporter input object is invalid, uninitialized, or not explicitly declared and strongly typed

This agent generates DXL from the current database.

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.CurrentDatabase

REM Open xml file named after current database

Dim stream As NotesStream

Set stream = session.CreateStream

filename$ = "c:\dxl" & Left(db.FileName, Len(db.FileName) - 3) & “dxl”

If Not stream.Open(filename$) Then

Messagebox "Cannot open " & filename$,, "Error"

Exit Sub

End If

Call stream.Truncate

REM Export current database as DXL

Dim exporter As NotesDXLExporter

Set exporter = session.CreateDXLExporter

Call exporter.SetInput(db)

Call exporter.SetOutput(stream)

Call exporter.Process

End Sub

Subject: NotesDXLExporter class and notesrichtextitem

What is the code you are trying to use with the rich text item? (The database code is good.)

Subject: RE: NotesDXLExporter class and notesrichtextitem

Below is rough code… I just dumped this into an existing button for testing… some extra dims in there.

I am getting my richtext item using doc.getfirstitem(“”). In the below code, I am putting it into a richtextitem, but I have also tried putting it into a variant. Both throw the error I mentioned in last post.

Any ideas?

On Error Goto errorHandler

’ Date: 06/07/2005

’ Created by: Jamie Haynes

’ Purpose To generate a ‘Printable’ Manager Report with all Daily Data document information

'included.

’ Paramenters: n/a

’ Called From: Generate Print Out action button

’ Calls:LogError from OpenLogFunctions SL

'IntegerToWeekDay function in Utilities SL

’ Globals: LocationToName function in Utilities SL

Dim nsess As New notessession ’ Used in error handling as well.

Dim rtitemRptDetails As notesrichtextitem

dim ndocCurrent As notesdocument

Dim wrkSpc As New notesuiworkspace

Dim uidocCurrent As notesuidocument

Dim ndbCurrent As notesdatabase

Dim rtnav As NotesRichTextNavigator

Dim ndocDailyData As notesdocument

Dim strLookup As String

Dim varRetVal As Variant

Set ndbCurrent = nsess.currentdatabase

'// Get handle to current document

Set uidocCurrent = wrkSpc.currentdocument

Set ndocCurrent = uidocCurrent.document

’ TEST -------------------------------------------------------------------//

'This agent generates DXL from the current database.

’ Dim session As New NotesSession

’ Dim db As NotesDatabase

’ Set db = session.CurrentDatabase

Dim filename As String

REM Open xml file named after current database

Dim stream As NotesStream

Set stream = nsess.CreateStream

filename$ = "c:\dxl" & Left( ndbCurrent.FileName, Len( ndbCurrent.FileName) - 3) & “dxl”

If Not stream.Open(filename$) Then

Messagebox "Cannot open " & filename$,, "Error"

Exit Sub

End If

Call stream.Truncate

REM Export current database as DXL

Dim exporter As NotesDXLExporter

Set exporter = nsess.CreateDXLExporter

'Dim varDet as variant

Dim rtitmDet As notesrichtextitem

Set rtitmDet = ndocCurrent.GetFirstItem(“Details”)

Call exporter.SetInput( rtitmDet ) ’ varDet ndocCurrent ; ’ ndbCurrent

Call exporter.SetOutput( stream )

Call exporter.Process



Msgbox "All done!"

Exit Sub

Subject: RE: NotesDXLExporter class and notesrichtextitem

Uh, you might want to take another look at the Help entry for SetInput:

Parameters

Input

For NotesDXLExporter this parameter is an object of the following type:

NotesDatabase

NotesDocument

NotesDocumentCollection

NotesNoteCollection

For all other processes this parameter is a string or an object of the following type:

NotesDOMParser (pipelines from a NotesDOMParser object)

NotesDXLExporter (pipelines from a NotesDXLExporter object)

NotesRichTextItem

NotesSAXParser (pipelines from a NotesSAXParser object)

NotesStream

NotesXSLTransformer (pipelines from a NotesXSLTransformer object)

Subject: RE: NotesDXLExporter class and notesrichtextitem

OK, you’re right. I wasn’t reading the documentation correctly. Thanks for the heads up.

Here is the code that I finally got to work. I pass in notesdocument to dxlexporter and dump it to saxparser which allows me to go through the tags and look for the rich text item which i wanted to parse though. That was my goal. The saxParser output is a richtextitem, but this doesn’t seem to be working. Which is fine with me because I really just wanted to parse.

I think they need more examples in the help on this stuff.

Thanks again for your help. Sometimes you stare at something so long, nothing looks right!

  • jamie

Set rtitmBodyfield = New notesRichTextItem( ndocRptDetail, “Body” )

	'Create the SAX parser

	Dim saxParser As NotesSAXParser

	' Create DXL Exporter

	Dim exporter As NotesDXLExporter

	

	' Initialize SAX parser object.

	Set saxParser = nsess.CreateSAXParser()

	' Convert the document's Data to DXL...

	Set exporter = nsess.CreateDXLExporter()

	Call exporter.SetInput( ndocDD ) 

’ Call exporter.SetOutput( saxParser )

	Call saxParser.SetInput( exporter )

	Call saxParser.SetOutput( rtitmBodyfield )

	

	On Event SAX_StartElement From saxParser Call SAXStartElement

	

	Call exporter.Process