Please enable JavaScript to view this site.

QPR Knowledge Base 2019.1

Navigation: Developer's Guide > QPR API > The Object Model > QPR Modeling > PGModel Commands

ExecuteXMLTask

Scroll Prev Top Next More

Revision history:

Introduced in QPR 7.2.1

Last changed in QPR 2012.2

 

Performs XML operation on a model. The XML tasks are included in a setting file.

 

Synopsis:

 

PGModel.ExecuteXMLTask(SettingFile, XMLFile, XSLFile, ImportMode)

 

Parameters:

 

SettingFile: String. File containing integration task settings

XMLFile: String. Source or target (depending on the operation) XML file.

XSLFile: String. Name of possible XSLT file for exporting to / importing from a different XML format.

ImportMode: There are three possible string values for this option:

ReplaceOnly

ReplaceCreate

CreateAll

 

All of the ImportMode options above require model administrator or administrator rights. However, in the case the value of ImportMode is "", then it is possible for a user with at least view rights to all diagrams in the model to execute the command.

 

Required Rights:

 

Administrator.

 

Return Values:

Below are listed the return values that this function can return:

 

RV_SUCCESS

RV_APPLICATION_QUIT_CALLED

RV_MODEL_NOT_OPEN

RV_ONLY_ADMINISTRATOR_CAN_EXECUTE_XML_TASKS

RV_INVALID_ATTRIBUTE_VALUE

RV_INVALID_IMPORT_MODE

RV_INVALID_XML_SETTINGS_FILE

RV_EXECUTING_XML_TASK_FAILED

RV_FUNCTION_CANNOT_BE_USED_IN_VALIDATION_SCRIPT

 

Example Procedure:

 

Sub ExecuteXMLOnFileModel()

 Dim iResult

 Dim oModel

 iResult = PGApplication.OpenFileModel("C:\PGModels\ExportTest.qprdam", "", oModel)

 If (iResult <> 0) Then

   MsgBox "Open XML file model failed: " + PGApplication.GetErrorMessage(iResult)

 End If

 

 iResult = oModel.ExecuteXMLTask("Export All.PGT", "C:\Temp\PGExport.xml", "", "")

 If (iResult <> 0) Then

   MsgBox "Execute XML export failed: " + PGApplication.GetErrorMessage(iResult)

 End If

 

 iResult = oModel.CloseModel(1)

 If (iResult <> 0) Then

   MsgBox "Close XML file model failed: " + PGApplication.GetErrorMessage(iResult)

 End If

 Set oModel = Nothing

End Sub