Altova XMLSpy 2024 Enterprise Edition

The code listings below show how the application can be started up and shut down.

 

Application startup

Before starting up the application, the appropriate classes must be imported (see below).

 

01 // Access general JAVA-COM bridge classes

02 import com.altova.automation.libs.*;

03

04 // Access XMLSpy Java-COM bridge

05 import com.altova.automation.XMLSpy.*;

06 import com.altova.automation.XMLSpy.Enums.SPYViewModes;

07

08 /**

09  * An example that starts XMLSpy COM server and performs view operations on it

10  * Feel free to extend

11  */

12 public class RunXMLSpy

13 {

14   public static void main(String[] args)

15   {

16     // An instance of the application.

17     Application xmlSpy = null;

18

19     // Instead of COM error handling, use Java exception mechanism

20     try

21     {

22         // Start XMLSpy as COM server

23           xmlSpy = new Application();

24         // COM servers start up invisible, so make it visible

25           xmlSpy.setVisible(true);

26

27 ...

28     }

29   }

30 }

 

Application shutdown

The application can be shut down as shown below.

 

01 {

02       // Allow shutdown of XMLSpy by releasing the UI.

03       xmlSpy.setVisible(true);

04

05       // Make sure that XMLSpy can shut down properly.

06       if (xmlSpy != null)

07         xmlSpy.dispose();

08

09       // Since the COM server was made visible and still is visible,

10       // it will keep running, and needs to be closed manually.

11       System.out.println("Now close XMLSpy!");

12 }

 

© 2017-2023 Altova GmbH