ICalendarSetup.LoadFromXml

Fore Syntax

LoadFromXml(Element: Variant);

Fore.NET Syntax

LoadFromXml(Element: object);

Parameters

Element. Object from which calendar parameters should be loaded.

Description

The LoadFromXml method loads calendar parameters from XML code.

Comments

Use the ICalendarSetup.SaveToXml method to upload parameters to XML code.

Fore Example

Executing the example requires calendar dictionary with the CALENDARSETUP identifier. The file C:\CalendarSetup.xml should contain parameters of the dictionary with dynamically created elements. Add links to the Dimensions, Metabase and Xml system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    CalendarObj: IMetabaseObject;
    Calendar: ICalendarDimension;
    CalendDimInst: IDimInstance;
    DynamicCalendInst: IDynamicCalendarInstance;
    Setup: ICalendarSetup;
    Node: IXmlDomElement;
    DestXML: FreeThreadedDOMDocument60;
Begin
    mb := MetabaseClass.Active;
    CalendarObj := mb.ItemById("CALENDARSETUP").Edit;
    Calendar := CalendarObj.Edit As ICalendarDimension;
    CalendDimInst := Calendar.OpenAs(CalendarOpenType.Flat);
    DynamicCalendInst := CalendDimInst As IDynamicCalendarInstance;
    Setup := Calendar.Setup;
    DestXML := New FreeThreadedDOMDocument60.Create;
    DestXML.load("C:\CalendarSetup.xml");
    Node := DestXML.documentElement;
    Setup.LoadFromXml(Node);
    CalendarObj.Save;
End Sub UserProc;

After executing the example parameters of the CALENDARSETUP calendar are loaded from the file C:\CalendarSetup.xml.

Fore.NET Example

Executing the example requires calendar dictionary with the CALENDARSETUP identifier. The file C:\CalendarSetup.xml should contain parameters of the dictionary with dynamically created elements.

Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.MsXml2;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    CalendarObj: IMetabaseObject;
    Calendar: ICalendarDimension;
    CalendDimInst: IDimInstance;
    DynamicCalendInst: IDynamicCalendarInstance;
    Setup: ICalendarSetup;
    Node: IXmlDomElement;
    DestXML: FreeThreadedDOMDocument60;
Begin
    mb := Params.Metabase;
    CalendarObj := mb.ItemById["CALENDARSETUP"].Edit();
    Calendar := CalendarObj.Edit() As ICalendarDimension;
    CalendDimInst := Calendar.OpenAs(CalendarOpenType.caoptyFlat);
    DynamicCalendInst := CalendDimInst As IDynamicCalendarInstance;
    Setup := Calendar.Setup;
    DestXML := New FreeThreadedDOMDocument60.Create();
    DestXML.load("C:\CalendarSetup.xml");
    Node := DestXML.documentElement;
    Setup.LoadFromXml(Node);
    CalendarObj.Save();
End Sub;

After executing the example parameters of the CALENDARSETUP calendar are loaded from the file C:\CalendarSetup.xml.

See also:

ICalendarSetup