Example: exportDxl method

This agent generates DXL for all the design elements from the current database.

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();

      // (Your code goes here) 
      // Build note collection of all design elements
      Database db = agentContext.getCurrentDatabase();
      NoteCollection nc = db.createNoteCollection(false);
      nc.selectAllDesignElements(true);
      nc.buildCollection();
      // Export to file
      String filename = "c:\\dxl\\exportedstuff.dxl";
      Stream stream = session.createStream();
      if (stream.open(filename)) {
        stream.truncate(); // Any existing file is erased
        DxlExporter exporter = session.createDxlExporter();
        System.out.println("Exported " +
           stream.writeText(exporter.exportDxl(nc)) + 
          " bytes to c:\\dxl\\exportedstuff.dxl");
      }
      else
        System.out.println("Cannot open " + filename);

    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}