Altova XMLSpy 2023 Enterprise Edition

XMLSpy ActiveX components can be accessed from Java code. Java integration is provided by the libraries listed below. These libraries are available in the folder <ApplicationFolder>\Examples\JavaAPI of your XMLSpy installation, after you have installed both XMLSpy and the XMLSpy Integration Package (see also Prerequisites).

 

AltovaAutomation.dll: a JNI wrapper for Altova automation servers (in case of the 32-bit installation of XMLSpy)

AltovaAutomation_x64.dll: a JNI wrapper for Altova automation servers (in case of the 64-bit installation of XMLSpy)

AltovaAutomation.jar: Java classes to access Altova automation servers

XMLSpyActiveX.jar: Java classes that wrap the XMLSpy ActiveX interface

XMLSpyActiveX_JavaDoc.zip: a Javadoc file containing help documentation for the Java interface

 

Note:In order to use the Java ActiveX integration, the .dll and .jar files must be included in the Java class search path.

 

Example Java project

An example Java project is supplied with your product installation. You can test the Java project and modify and use it as you like. For more details, see Example Java Project.

 

Rules for mapping the ActiveX Control names to Java

For the documentation of ActiveX controls, see Object Reference. Note that the object naming conventions are slightly different in Java compared to other languages. Namely, the rules for mapping between the ActiveX controls and the Java wrapper are as follows:

 

Classes and class names
For every component of the XMLSpy ActiveX interface a Java class exists with the name of the component.

 

Method names
Method names on the Java interface are the same as used on the COM interfaces but start with a small letter to conform to Java naming conventions. To access COM properties, Java methods that prefix the property name with get and set can be used. If a property does not support write-access, no setter method is available. Example: For the IntegrationLevel property of the XMLSpyControl, the Java methods getIntegrationLevel and setIntegrationLevel are available. 

 

Enumerations
For every enumeration defined in the ActiveX interface, a Java enumeration is defined with the same name and values.

 

Events and event handlers
For every interface in the automation interface that supports events, a Java interface with the same name plus 'Event' is available. To simplify the overloading of single events, a Java class with default implementations for all events is provided. The name of this Java class is the name of the event interface plus 'DefaultHandler'. For example:

XMLSpyControl: Java class to access the application

XMLSpyControlEvents: Events interface for the XMLSpyControl

XMLSpyControlEventsDefaultHandler: Default handler for XMLSpyControlEvents

 

Exceptions to mapping rules

There are some exceptions to the rules listed above. These are listed below:

 

Interface

Java name

XMLSpyControlDocument, method New

newDocument

Document, method SetEncoding

setFileEncoding

AuthenticView, method Goto

gotoElement

AuthenticRange, method Goto

gotoElement

AuthenticRange, method Clone

cloneRange

 

This section

This section shows how some basic XMLSpy ActiveX functionality can be accessed from Java code. It is organized into the following sub-sections:

 

Example Java Project

Creating the ActiveX Controls

Loading Data in the Controls

Basic Event Handling

Menus

UI Update Event Handling

Creating an XML Tree

© 2017-2023 Altova GmbH