Altova XMLSpy 2024 Enterprise Edition

Programmers' Reference

Home Prev Top Next

XMLSpy is an Automation Server: It exposes programmable objects to other applications called Automation Clients. An Automation Client can directly access the objects and functionality that the Automation Server makes available. So, an Automation Client of XMLSpy can use, for example, the XML validation functionality of XMLSpy. As a consequence, developers can enhance their applications with the ready-made functionality of XMLSpy.

 

The programmable objects of XMLSpy are made available to Automation Clients via the Application API of XMLSpy, which is a COM API. The Application API of XMLSpy will also be called Application API for short from now onwards. The object model of the Application API and a complete description of all the available objects are provided in this documentation (see the section Application API).

 

Execution environments

The Application API can be accessed from within the following environments:

 

Scripting Editor

IDE Plug-ins

External programs

ActiveX Integration

 

Each of these environments is described briefly below.

 

Scripting Editor: Customizing and modifying XMLSpy functionality

You can customize your installation of XMLSpy by modifying and adding functionality to it. You can also create Forms for user input and modify the user interface so that it contains new menu commands and toolbar shortcuts. All these features are achieved by writing scripts that interact with objects of the Application API. To aid you in carrying out these tasks efficiently, XMLSpy offers you an in-built Scripting Editor. A complete description of the functionality available in the Scripting Editor and how it is to be used is given in the Scripting Editor section of this documentation. The supported programming languages are JScript and VBScript.

 

IDE Plug-ins: Creating plug-ins for XMLSpy

XMLSpy enables you to create your own plug-ins and integrate them into XMLSpy. You can do this using XMLSpy's special interface for plug-ins. A description of how to create plug-ins is given in the section XMLSpy IDE Plug-ins.  An application object gets passed to most methods that must be implemented by an IDE plug-in and gets called by the application. Typical languages used to implement an IDE plug-in are C# and C++. For more information, see the section XMLSpy IDE Plugins.

 

External programs

Additionally, you can manipulate XMLSpy with external scripts. For example, you could write a script to open XMLSpy at a given time, then open an XML file in XMLSpy, validate the file, and print it out. External scripts would again make use of the Application API to carry out these tasks. For a description of the Application API, see the section Application API.

 

Using the Application API from outside XMLSpy requires an instance of XMLSpy to be started first. How this is done depends on the programming language used. See the section, Programming Languages, for information about individual languages.

 

Essentially, XMLSpy will be started via its COM registration. Then the Application object associated with the XMLSpy instance is returned. Depending on the COM settings, an object associated with an already running XMLSpy can be returned. Any programming language that supports creation and invocation of COM objects can be used. The most common of these are listed below.

 

JScript and VBScript script files have a simple syntax and are designed to access COM objects. They can be run directly from a DOS command line or with a double click on Windows Explorer. They are best used for simple automation tasks.

C# is a full-fledged programming language that has a wide range of existing functionality. Access to COM objects can be automatically wrapped using C#..

C++ provides direct control over COM access but requires relatively larger amounts of code than the other languages.

Java: Altova products come with native Java classes that wrap the Application API and provide a full Java look-and-feel.

Other programming languages that make useful alternatives are: Visual Basic for Applications, Perl, and Python.

 

ActiveX Integration

A special case of accessing the Application API is via the XMLSpy ActiveX control. This feature is only available if the XMLSpy integration package is installed. Every ActiveX Control has a property that returns a corresponding COM object for its underlying functionality. The manager control provides an Application object, the document control a Document object, and the placeholder object, in cases where it contains the project tree, returns the Project object. The methods supported by these objects are exactly as described in the Interfaces section of the Application API. Care must be taken not to use methods that do not make sense in the context of ActiveX control integration. For details see ActiveX Integration.

 

About Programmers' Reference

The documentation contained in the Programmers' Reference for XMLSpy consists of the following sections:

 

Scripting Editor: a user reference for the Scripting Environment available in XMLSpy

IDE Plug-ins: a description of how to create plug-ins for XMLSpy

Application API: a reference for the Application API

ActiveX Integration: a guide and reference for how to integrate the XMLSpy GUI and XMLSpy functionality using an ActiveX control

 

© 2017-2023 Altova GmbH