Altova XMLSpy 2024 Enterprise Edition

The Application API can be accessed from Java code. To allow accessing the XMLSpy automation server directly from Java code, the libraries listed below must reside in the classpath. They are installed in the folder: JavaAPI in the XMLSpy application folder.

 

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

AltovaAutomation.jar: Java classes to access Altova automation servers

XMLSpyAPI.jar: Java classes that wrap the XMLSpy automation interface

XMLSpyAPI_JavaDoc.zip: a Javadoc file containing help documentation for the Java API

 

Note:In order to use the Java API, the DLL and Jar files must be on the Java Classpath.

 

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 of the example Java project, see the section, Example Java Project.

 

Rules for mapping the Application API names to Java

The rules for mapping between the Application API and the Java wrapper are as follows:

 

Classes and class names

For every interface of the XMLSpy automation interface a Java class exists with the name of the interface.

 

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 Name property of the Document interface, the Java methods getName and setName are available.

 

Enumerations

For every enumeration defined in the automation 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:

Application: Java class to access the application

ApplicationEvents: Events interface for the Application

ApplicationEventsDefaultHandler: Default handler for ApplicationEvents

 

Exceptions to mapping rules

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

 

Interface

Java name

Document, method SetEncoding

setFileEncoding

AuthenticView, method Goto

gotoElement

AuthenticRange, method Goto

gotoElement

AuthenticRange, method Clone

cloneRange

 

This section

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

 

Example Java Project

Application Startup and Shutdown

Simple Document Access

Iterations

Use of Out-Parameters

Event Handlers

 

© 2018-2024 Altova GmbH