LoadFromXml(Element: IXmlDomElement);
SaveToXml(Element: Prognoz.Platform.Interop.MsXml2.IXmlDomElement);
Element. The element, from which the publisher parameters are loaded.
The LoadFromXml method loads parameters of mobile application publisher from XML file.
To load publisher parameters to XML file, use the IMobileApplicationPublicator.SaveToXml method.
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 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 published mobile application (MA)
Mobile := mb.ItemById("MA_PUB").Bind As IMobileApplication;
// Create a mobile application publisher
Publicator := Mobile.CreatePublicator;
// Load publishing parameters
XmlDoc := New DOMDocument60.Create;
XmlDoc.load("C:\Publicator.xml");
el := XmlDoc.selectSingleNode("Root") As IXmlDomElement;
Publicator.LoadFromXml(el);
// Publish mobile application
res := Publicator.Execute(Null);
// Handle results of mobile application publication
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: publisher parameters are loaded from the C:\Publicator.xml file, the mobile application is published according to the loaded parameters and publishing results are displayed in the console window.
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 published mobile application (MA)
Mobile := mb.ItemById["MA_PUB"].Bind() As IMobileApplication;
// Create a mobile application publisher
Publicator := Mobile.CreatePublicator();
// Load publishing parameters
XmlDoc := New DOMDocument60.Create();
XmlDoc.load("C:\Publicator.xml");
el := XmlDoc.selectSingleNode("Root") As IXmlDomElement;
Publicator.LoadFromXml(el);
// Publish mobile application
res := Publicator.Execute(Null);
// Handle results of mobile application publication
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: publisher parameters are loaded from the C:\Publicator.xml file, the mobile application is published according to the loaded parameters and publishing results are displayed in the console window.
See also: