JAVA/CORBA CLASSES


Examples: generateXML method
The following agent creates a document with three items in the current database, generates an XML representation of this document, and writes the result into the specified file.

import lotus.domino.*;
import java.io.*;
public class JavaAgent extends AgentBase {
 public void NotesMain() {
   try {
     Session session = getSession();
     AgentContext agentContext = session.getAgentContext();
     // (Your code goes here)
     Database db = agentContext.getCurrentDatabase();
     Document doc = db.createDocument();
      DateTime dt1 = session.createDateTime("June 16, 1999");
      doc.replaceItemValue ("Form", "DocForm");
     doc.replaceItemValue ("Text1", "This is some text!");
      doc.replaceItemValue ("DateTime1", dt1);
     
       BufferedWriter bw = new BufferedWriter(new
             FileWriter("c:\\temp\\document.xml"));
       doc.generateXML(bw);
     bw.close();
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also