IMobileApplicationPublishObjects.LoadFromXml

Fore Syntax

LoadFromXml(Element: IXmlDomElement);

Fore.NET Syntax

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

Parameters

Element. The element from which the parameters of the mobile application objects 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

The example is a procedure with the following input parameters:

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

Sub LoadParams(Publicator: IMobileApplicationPublicator; File: String; MbObj: IMetabaseObject);
Var
    MaPubObjs: IMobileApplicationPublishObjects;
    XmlDoc: IXmlDomDocument3;
    el: IXmlDomElement;
    MaPubObj: IMobileApplicationPublishObject;
    PublishObject: IMobilePublishObject;
    res: MobilePublishObjectResult;
    s: String;
Begin
    MaPubObjs := Publicator.Items;
    // Loading parameters of the mobile application objects
    XmlDoc := New DOMDocument60.Create;
    XmlDoc.load(File);
    el := XmlDoc.selectSingleNode("Root"As IXmlDomElement;
    MaPubObjs.LoadFromXml(el);
    // Check whether the specified object is included in the mobile application
    MaPubObj := MaPubObjs.ItemByKey(MbObj.Key);
    If MaPubObj <> Null Then
        If MaPubObj.IsValid Then // The object is included and available for publishing
            PublishObject := MaPubObj.PublishObject;
            // Specify the path for saving the object
            PublishObject.ExportPath := "C:\" + MbObj.Id + ".zip";
            // Specify the object version
            PublishObject.Version := "1.0";
            // Publish the object
            res := PublishObject.Publish(Null);
            // Save the publishing parameters
            XmlDoc := New DOMDocument60.Create;
            el := XmlDoc.createElement("Root");
            XmlDoc.appendChild(el);
            PublishObject.SaveToXml(el);
            XmlDoc.save("C:\PublishObject.xml");
            // Display the publishing results in the console window
            s := MbObj.Name + " (" + MbObj.Id + ")";
            If res = MobilePublishObjectResult.OK Then
                Debug.WriteLine("Object publishing '" + s + "' is finished");
            Else
                Debug.WriteLine("Error publishing the '" + s + "' object")
            End If;
        End If;
        // Save parameters of the mobile application object
        XmlDoc := New DOMDocument60.Create;
        el := XmlDoc.createElement("Root");
        XmlDoc.appendChild(el);
        MaPubObj.SaveToXml(el);
        XmlDoc.save("C:\" + MbObj.Id + ".xml");
    End If;
End Sub LoadParams;

The procedure result: the parameters of the mobile application object are loaded from the File file. If the MbObj object is included in the mobile application and available for publishing, it is to be published. The publishing results are displayed in the console window. The parameters of the mobile application object and the object publishing parameters are saved in he XML format.

Fore.NET Example

The example is a procedure with the following input parameters:

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

Public Shared Sub LoadParams(Publicator: IMobileApplicationPublicator; File: String; MbObj: IMetabaseObject);
Var
    MaPubObjs: IMobileApplicationPublishObjects;
    XmlDoc: IXmlDomDocument3;
    el: IXmlDomElement;
    MaPubObj: IMobileApplicationPublishObject;
    PublishObject: IMobilePublishObject;
    res: MobilePublishObjectResult;
    s: String;
Begin
    MaPubObjs := Publicator.Items;
    // Loading parameters of the mobile application objects
    XmlDoc := New DOMDocument60.Create();
    XmlDoc.load(File);
    el := XmlDoc.selectSingleNode("Root"As IXmlDomElement;
    MaPubObjs.LoadFromXml(el);
    // Check whether the specified object is included in the mobile application
    MaPubObj := MaPubObjs.ItemByKey[MbObj.Key];
    If MaPubObj <> Null Then
        If MaPubObj.IsValid Then // The object is included and available for publishing
            PublishObject := MaPubObj.PublishObject;
            // Specify the path for saving the object
            PublishObject.ExportPath := "C:\" + MbObj.Id + ".zip";
            // Specify the object version
            PublishObject.Version := "1.0";
            // Publish the object
            res := PublishObject.Publish(Null);
            // Save the publishing parameters
            XmlDoc := New DOMDocument60.Create();
            el := XmlDoc.createElement("Root");
            XmlDoc.appendChild(el);
            PublishObject.SaveToXml(el);
            XmlDoc.save("C:\PublishObject.xml");
            // Display the publishing results in the console window
            s := MbObj.Name + " (" + MbObj.Id + ")";
            If res = MobilePublishObjectResult.mporOK Then
                System.Diagnostics.Debug.WriteLine("Object publishing '" + s + "' is finished").
            Else
                System.Diagnostics.Debug.WriteLine("Erro occurred on '" + s + "' publishing the object").
            End If;
        End If;
        // Save parameters of the mobile application object
        XmlDoc := New DOMDocument60.Create();
        el := XmlDoc.createElement("Root");
        XmlDoc.appendChild(el);
        MaPubObj.SaveToXml(el);
        XmlDoc.save("C:\" + MbObj.Id + ".xml");
    End If;
End Sub LoadParams;

The procedure result: the parameters of the mobile application object are loaded from the File file. If the MbObj object is included in the mobile application and available for publishing, it is to be published. The publishing results are displayed in the console window. The parameters of the mobile application object and the object publishing parameters are saved in he XML format.

See also:

IMobileApplicationPublishObjects