astah* API User Guide


[Import/Export XML]

XML Input/Output is supported in astah* professional.

[Export/Import XML, Save as Project]

Export XML

Export astah* Project file to XML file (.xml).

Example of Export XML
					
import com.change_vision.jude.api.inf.AstahAPI;
import com.change_vision.jude.api.inf.project.ProjectAccessor;

public class Test {
  public static void main(String[] args) {
    try {
        ProjectAccessor prjAccessor = AstahAPI.getAstahAPI().getProjectAccessor();

        prjAccessor.open("C:\\API\\pro305.asta");
        prjAccessor.exportXMI("C:\\API\\pro305_xmi.xml");
        prjAccessor.close();

    } catch (Exception e) {
        e.printStackTrace();
    }
  }
}
				

Import XML

Import XML project file(.xml) to a astah* project file.
Ensure to let the ClassPath go through the jar that locates in the astah* professional Install folder\lib to execute XML Import.

Save as Project

Save as a new project(.asta).

Example of XML Import and saving it as Project with name
					
import com.change_vision.jude.api.inf.AstahAPI;
import com.change_vision.jude.api.inf.project.ProjectAccessor;

public class Test {
  public static void main(String[] args) {
    try {
        ProjectAccessor prjAccessor = AstahAPI.getAstahAPI().getProjectAccessor();

        prjAccessor.importXMI("C:\\API\\pro305_xmi.xml");
        prjAccessor.saveAs("C:\\API\\pro305_2.asta"); 
        prjAccessor.close();
          
    } catch (Exception e) {
        e.printStackTrace();
    }
  }
}

				

Process of Import/Export XML with astah* API

Here is a process of Import/Export XML using astah* API.

Example: Export astah* project file to XML - Modify the XML - Import XML - Save as astah* project file
					
import com.change_vision.jude.api.inf.AstahAPI;
import com.change_vision.jude.api.inf.project.ProjectAccessor;

public class Test {
  public static void main(String[] args) {
    try {
        ProjectAccessor prjAccessor = AstahAPI.getAstahAPI().getProjectAccessor();

        prjAccessor.open("C:\\API\\pro305.asta");
        prjAccessor.exportXMI("C:\\API\\pro305_xmi.xml");
        prjAccessor.close();

        // Edit

        prjAccessor.importXMI("C:\\API\\pro305_xmi.xml");
        prjAccessor.saveAs("C:\\API\\pro305_2.asta"); 
        prjAccessor.close();
          
    } catch (Exception e) {
        e.printStackTrace();
    }
  }
}

				


Home