Altova XMLSpy 2025 Professional Edition

The listing below shows how to iterate through open documents.

 

 

01  // Iterate through open documents and set view mode to 'Text'.

02  for (Document doc:xmlSpy.getDocuments())

03    if ( doc.getCurrentViewMode() != SPYViewModes.spyViewText)

04             doc.switchViewMode(SPYViewModes.spyViewText);

05

06  // An alternative iteration mode is index-based

07  // COM indices are typically zero-based

08  Documents documents = xmlSpy.getDocuments();

09     for (int i = 1; i <= documents.getCount();

10         i++)

11       {

12         Document doc = documents.getItem(i);

13               ...

14       }

 

© 2018-2024 Altova GmbH