DXL/Serialize... I am sooo close

somebody have pity on me… i am so close to getting this… all i am trying to do is export a notes note collection, pipeline to a domparser, modify an attribute, and re-import. my code runs, i get no errors, and msgboxes alert that the value is being updated, but nothing happens… the bgcolor remains “yellow.” any advice?

Sub Initialize

Dim nc As NotesNoteCollection



Set session = New NotesSession

Set db = session.CurrentDatabase

Set nc = db.CreateNoteCollection(False)

Call nc.SelectAllFormatElements(True)

nc.SelectMiscCodeElements = True

nc.SelectMiscFormatElements = True

nc.SelectForms = True



Call nc.BuildCollection



Dim dxp As NotesDXLExporter

Set dxp = session.CreateDXLExporter(nc)



Dim par As NotesDOMParser

Set par = session.CreateDOMParser(dxp)

On Event PostDOMParse From par Call ProcessDOM



Dim dip As NotesDXLImporter

Set dip = session.CreateDXLImporter(par, db)



dxp.Process

End Sub

Sub ProcessDOM(Source As NotesDOMParser)

Dim elems As NotesDOMNodeList

Dim elem As NotesDOMElementNode	

Dim attrs As NotesDomNamedNodeMap		

Dim NumAttributes As Integer

Dim a As NotesDomAttributeNode



Set elems = Source.Document.GetElementsByTagName("actionbar")

’ Msgbox "elems.NumberOfEntries = " + Cstr( elems.NumberOfEntries )

For i& = 1 To elems.NumberOfEntries

	

	Set elem = elems.GetItem(i&)		

	Set attrs = elem.Attributes		

	numAttributes = elem.attributes.numberofentries

'	Msgbox Cstr ( numAttributes )

	

	Dim j As Integer

	For j = 1 To numAttributes     ' Loop through them

		Set a = attrs.GetItem(j)

		If a.NodeName = "bgcolor" Then

			Msgbox "attribute name : " + a.NodeName + "      attribute value : " + a.NodeValue

			a.NodeValue ="red"

			Msgbox "attribute name : " + a.NodeName + "      attribute value : " + a.NodeValue

			

		End If

		

	Next

Next



Source.Serialize

End Sub

Subject: DXL/Serialize… I am sooo close

You are working with design notes, and the default is to ignore them! You might think the log would tell you that it had ignored some notes, but that would be making things far too easy. If IBM designed its products like that, these forums would be no fun at all. Use this setting to replace the existing notes:dip.DesignImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE

Subject: RE: DXL/Serialize… I am sooo close

THANK YOU! That was what I was missing! I was able to change the actionbar color of some forms and views.

Now, I have another problem that I fear wont be so easy to resolve…

If I have any shared actions on my forms or views, I get the following error to the log

"<?xml version='1.0'?>Referenced shared action(s) not found - creating dummy action(s)Object or data is corruptedDXL importer operation failed…

EVEN if the shared action includes code as simple as @Command([EditDocument]). I run my agent selecting forms with only 1 form in the database… when I remove the shared action from the form the agent runs. When add the shared action to the form, the agent fails with the above stated error. For the record, I did include nc.SelectActions = True.

I reported this error a long time ago in SPR TSMH5GNMHK, that was said to have been resolved in the following document:

http://www-10.lotus.com/ldd/r5fixlist.nsf/5c087391999d06e7852569280062619d/99b064675c015ab885256d25006bb854?OpenDocument&Highlight=0,TSMH5GNMHK

Unfortunately, it appears that this issue still exists, as the error in the log is identical to what it was a year ago+.

Any futher thoughts? Perhaps I am missing another include?

Thanks,

Theresa


Sub Initialize

Dim nc As NotesNoteCollection



Set session = New NotesSession

Set db = session.CurrentDatabase

Set nc = db.CreateNoteCollection(False)

Call nc.SelectAllFormatElements(True)

Call nc.SelectAllCodeElements(True)

Call nc.SelectAllDesignElements(True)

nc.SelectMiscCodeElements = True

nc.SelectMiscFormatElements = True

nc.SelectForms = True

nc.SelectActions = True



Call nc.BuildCollection



Dim dxp As NotesDXLExporter

Set dxp = session.CreateDXLExporter(nc)



Dim par As NotesDOMParser

Set par = session.CreateDOMParser(dxp)

On Event PostDOMParse From par Call ProcessDOM



Dim dip As NotesDXLImporter

Set dip = session.CreateDXLImporter(par, db)

dip.DesignImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE



dxp.Process

End Sub

Sub ProcessDOM(Source As NotesDOMParser)

Dim elems As NotesDOMNodeList

Dim elem As NotesDOMElementNode	

Dim attrs As NotesDomNamedNodeMap		

Dim NumAttributes As Integer

Dim a As NotesDomAttributeNode



Set elems = Source.Document.GetElementsByTagName("actionbar")

’ Msgbox "elems.NumberOfEntries = " + Cstr( elems.NumberOfEntries )

For i& = 1 To elems.NumberOfEntries

	

	Set elem = elems.GetItem(i&)		

	Set attrs = elem.Attributes		

	numAttributes = elem.attributes.numberofentries

'	Msgbox Cstr ( numAttributes )

	

	Dim j As Integer

	For j = 1 To numAttributes     ' Loop through them

		Set a = attrs.GetItem(j)

		If a.NodeName = "bgcolor" Then

			Msgbox "attribute name : " + a.NodeName + "      attribute value : " + a.NodeValue

			a.NodeValue ="blue"

			Msgbox "attribute name : " + a.NodeName + "      attribute value : " + a.NodeValue

			

		End If

		

	Next

Next



Source.Serialize

End Sub

Subject: RE: DXL/Serialize… I am sooo close

A shared action in the form is OK when I do it. That SPR says “when DXL Importer loads shared actions”, but here you should not be loading any shared actions – you should only load a form containing a sharedactionref, not the shared actions note itself. I suspect that your NotesNoteCollection contains the shared actions note, and it will help to add:nc.SelectActions = False

In fact, the way you specify the collection you have overlapping criteria that could be cleaned up.

Subject: RE: DXL/Serialize… I am sooo close

UPDATE 2: I just copied the nec design elements to a newly created database… and all worked EXCEPT when I copy in a shared action in that has JAVASCRIPT as the web action !!! I bet if you change your shared action that has the following in the JS web action:alert(‘test’);

your import will fail too… the shared action does not even need to be the one that you shared on the form. in my test database, I have a shared action with JS in the web action … and this action is not shared on the one form I have in the database… and the import fails.

UPDATE 3: There has to be some formula in the Client action and JS in the web action. This will make the import fail.

Thanks for your prompt response… I am wondering why a shared action is working for you and not for me… I just cleaned up the code so it looks like this

Sub Initialize

Dim nc As NotesNoteCollection



Set session = New NotesSession

Set db = session.CurrentDatabase

Set nc = db.CreateNoteCollection(False)

nc.SelectForms = True

nc.SelectActions = False



Call nc.BuildCollection



Dim dxp As NotesDXLExporter

Set dxp = session.CreateDXLExporter(nc)



Dim par As NotesDOMParser

Set par = session.CreateDOMParser(dxp)

On Event PostDOMParse From par Call ProcessDOM



Dim dip As NotesDXLImporter

Set dip = session.CreateDXLImporter(par, db)

dip.DesignImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE



dxp.Process

End Sub

and I get the same msg to the log.

UPDATE: I just copied the nec design elements to a newly created database… and all worked. So… it must be something to do with the legacy of our databases… they may need to be recreated.

Thanks so much for your help!

Theresa

Subject: RE: DXL/Serialize… I am sooo close

Try setting:nc.SelectMiscCodeElements = False

I was getting a similar error while I was trying to parse all design elements of a large legacy database. I actually got:

Error #4602 on line 42: DOM parser operation failed

Set nc = dbInput.CreateNoteCollection(False)

Call nc.SelectAllDesignElements(True)

Call nc.BuildCollection

Set stream = session.CreateStream

Set exporter = session.CreateDXLExporter

Set DOMParser=Session.CreateDOMParser

Call exporter.SetInput(nc)

Call DOMParser.SetInput(exporter)

Call DOMParser.SetOutput(stream)

Call exporter.Process '<- Error #4602: DOM parser operation failed

After selecting all the notescollection selection options one at a time, I identified the “miscellaneous code elements” as the end culprit with my problems.

I’m not sure what consitutes a “Miscellaneous code element,” but it sure knows how to throws an annoying miscellaneous error.

ps. I’m running Domino Designer v6.5.5 on my local machine querying a local database. The DXLexporter has problems exporting some databases from remote servers.

Subject: RE: DXL/Serialize… I am sooo close

The SPR stated that the problem was doing the DXL import on actions that have LotusScript in them… but I changed my notesnotecollection to only include forms and actions (and many of them in the db contain LS), removed the shared actions from the from, and the agent ran. Then, when I added the single shared action containing only @Command([EditDocument]), the agent failed. Perhaps the analysis of the issue for the SPR was incomplete.