COM API
The COM-based API of XMLSpy enables other applications to use the functionality of XMLSpy. As a result, it is possible to automate a wide range of tasks, from validating an XML file to modifying complex XML content. XMLSpy and XMLSpy API follow the common specifications for automation servers set out by Microsoft. It is possible to access the methods and properties of the XMLSpy API from common development environments, such as those using C#, C++, VisualBasic, and Delphi, and with scripting languages like JScript and VBScript.
XMLSpy API documentation
The XMLSpy API documentation can be accessed here: https://www.altova.com/manual/en/api/xmlspyapi/index.html.
Usage
You can use external scripts to manipulate XMLSpy functionality. 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. Using the XMLSpy API from outside XMLSpy requires an instance of XMLSpy to be started first. How this is done depends on the programming language used. For information about individual languages, see the section of the API documentation called Programming 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.