Question about XML (DXL) for the experts

Can one of the experts tell me how I can specify a using LotusScript.

I am using XML to cerate a new document(Memo form) and populate the Body field. I have been successful in creating the form and populating the Body. I would now like to add 2 things

  1. Specify an Event - ie the PostOpen Event using XML

  2. Add JS to the JSHeader via XML.

Can anyone post a sample of how this may be done.

Code I am using …

Sub Click(Source As Button)

On Error Goto errrpt

link$ = "Lotus Users Forum"

url$ = "http://www.notes.net"



Dim session As New NotesSession



Dim db As NotesDatabase

Set db = session.CurrentDatabase



Dim stream As NotesStream

Set stream = session.CreateStream

stream.WriteText {<?xml version='1.0' encoding='utf-8' ?>

      <database xmlns='http://www.lotus.com/dxl' version='6.0'> 

         <code event="JSHeader" for="client">

                                      <javascript>alert("hello")</javascript>

                                       </code>                 



           <document form='Memo'>     

            

                <item name='Subject'><text>DXL demo</text></item>                     

                <item name='Body'>

                     <richtext>

                          <par>                                     

                               <run>Click on this link: </run>

                               <urllink showborder='false' href='} & url$ & {'>

                                    <run><font color='system'/>} & link$ & {</run>

                               </urllink>                                                              

                          </par>

                               

                     </richtext>

                </item>

            

           </document>                     

      </database>}



Dim dmp As NotesDXLImporter

Set dmp = session.CreateDXLIMporter(stream, db)

dmp.Process

Msgbox("Memo form cerated")

exit sub

errrpt:

Msgbox(dmp.log)

End Sub

thanks,

Subject: Question about XML (DXL) for the experts

You would need either to create a document with a stored form or modify the existing form in your code. Your current code says “use the Memo form”, which will not contain your JS Header, no matter how hard you try. Create a sample memo with the code you need (use a new database based on the mail template) and make sure the form is stored in the document, then export that document as a DXL “template”.

Subject: RE: Question about XML (DXL) for the experts

Stan - thanks for the post.

Question - is it possible to code the PostOpenEvent using the approach I initially asked about?? ie rather than go through the steps you mentioned… a PostOpen may be able to do what I need.

Also you mentioned “modify the existing form in your code”… what exactly are you referring to ??

I am open to any ideas.

Subject: RE: Question about XML (DXL) for the experts

No – those events belong to the form, not the document, so if you want them on a document-by-document basis, you need to store the form.

Subject: RE: Question about XML (DXL) for the experts

OK… got it… I can’t change the form and believe storing the form in the document will make it huge.

Other though / option is to try and specify a Formula or Code Event at a field level… ie for the Body Field or maybe a new Field created at the document level that contains a Formula/Code…

Any hints ??