Altova XMLSpy 2025 Professional Edition 

The code snippets below (from the AutomateXMLSpy example) show how two files are opened via two separate methods assigned to two buttons in the user interface. Both methods use the same Application API access mechanism: XMLSpy.Documents.OpenFile(string, boolean).

 

The AutomateXMLSpy example (see the file Form1.cs) is located in the C# subfolder of the API Examples folder:

 

 

Windows 7, Windows 8, Windows 10, Windows 11

C:\Usuarios\<usuario>\Documentos\
Altova\XMLSpy\2025\Examples

 

 

You can compile and run the project from within Visual Studio 2012/2013/2015/2017/2019/2022.

 

Code snippet

 

       // Handler for the "Open OrgChart.pxf" button

       private void openOrgChart_Click(object sender, EventArgs e)

       {

           // Make sure there's a running XMLSpy instance, and that it's visible

           StartXMLSpy_Click(null, null);

 

           // Open a file from the Examples folder installed with the product

           XMLSpy.Documents.OpenFile(strExamplesFolder + "OrgChart.pxf", false);

       }

 

       // Handler for the "Open ExpReport.xml" button

       private void openExpReport_Click(object sender, EventArgs e)

       {

           // Make sure there's a running XMLSpy instance, and that it's visible

           StartXMLSpy_Click(null, null);

 

           // Open a file from the Examples folder installed with the product

           XMLSpy.Documents.OpenFile(strExamplesFolder + "ExpReport.xml", false);

       }

 

The file opened last will be the active file.

 

© 2018-2024 Altova GmbH