IMobileApplicationPublicator.LoadFromXml

Fore Syntax

LoadFromXml(Element: IXmlDomElement);

Fore.NET Syntax

SaveToXml(Element: Prognoz.Platform.Interop.MsXml2.IXmlDomElement);

Parameters

Element. The elements from which the publicator parameters are loaded.

Description

The LoadFromXml method loads parameters of the mobile application objects from the XML file.

Comments

To load the publisher parameters to the XML file, use the IMobileApplicationPublicator.SaveToXml method.

Fore Example

Executing the example requires that the repository contains a mobile application with the MA_PUB identifier. The file system must contain the C:\Publicator.xml file with the publisher parameters.

Add links to the Metabase, Mobile, Xml system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    Mobile: IMobileApplication;
    Publicator: IMobileApplicationPublicator;
    XmlDoc: IXmlDomDocument3;
    el: IXmlDomElement;
    res: MobilePublishResult;
Begin
    mb := MetabaseClass.Active;
    // Get the published mobile application (MA)
    Mobile := mb.ItemById("MA_PUB").Bind As IMobileApplication;
    // Create a mobile application publicator 
    Publicator := Mobile.CreatePublicator;
    // Load the publishing parameters
    XmlDoc := New DOMDocument60.Create;
    XmlDoc.load("C:\Publicator.xml");
    el := XmlDoc.selectSingleNode("Root"As IXmlDomElement;
    Publicator.LoadFromXml(el);
    // Publish the mobile application
    res := Publicator.Execute(Null);
    // Handle the result of  publishing the mobile application
    If res = MobilePublishResult.Ok Then
        Debug.WriteLine("Publishing was successful").
    Else
        Debug.WriteLine("Error occurred on publishing:" + Publicator.GetPublishResultText(res));
    End If;
End Sub UserProc;

Example execution result: the publicator parameters are loaded from the C:\Publicator.xml file, the mobile application is published according to the loaded parameters and the publishing results are displayed in the console window.

Fore.NET Example

Executing the example requires that the repository contains a mobile application with the MA_PUB identifier.

Imports Prognoz.Platform.Interop.Mobile;
Imports Prognoz.Platform.Interop.MsXml2;

[STAThread]
Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    Mobile: IMobileApplication;
    Publicator: IMobileApplicationPublicator;
    XmlDoc: IXmlDomDocument3;
    el: IXmlDomElement;
    res: MobilePublishResult;
Begin
    mb := Params.Metabase;
    // Get the published mobile application (MA)
    Mobile := mb.ItemById["MA_PUB"].Bind() As IMobileApplication;
    // Create a mobile application publicator 
    Publicator := Mobile.CreatePublicator();
    // Load the publishing parameters
    XmlDoc := New DOMDocument60.Create();
    XmlDoc.load("C:\Publicator.xml");
    el := XmlDoc.selectSingleNode("Root"As IXmlDomElement;
    Publicator.LoadFromXml(el);
    // Publish the mobile application
    res := Publicator.Execute(Null);
    // Handle the result of  publishing the mobile application
    If res = MobilePublishResult.mprOk Then
        System.Diagnostics.Debug.WriteLine("Publishing was successful").
    Else
        System.Diagnostics.Debug.WriteLine("Error occurred on publishing: " + Publicator.GetPublishResultText(res));
    End If;
End Sub;

Example execution result: the publicator parameters are loaded from the C:\Publicator.xml file, the mobile application is published according to the loaded parameters and the publishing results are displayed in the console window.

See also:

IMobileApplicationPublicator