Load(Element: IXmlDomElement);
Element. XML element, from which selection is loaded.
The Load method loads selection from XML file.
To save selection to XML file, use the IDimSelection.Save method.
Executing the example requires that the repository contains a dictionary with the D_TO identifier and the D:\Documents.xml file to load selection.
Add links to the Dimensions, Metabase, and Xml system assemblies.
Sub UserProc;
Var
MB: IMetabase;
DimenObj: IMetabaseObject;
Dimen: IDimInstance;
Selection: IDimSelection;
XMLDoc: IXMLDOMDocument;
XMLName: String = "D:\Documents.xml";
XMLElem: IXMLDOMElement;
Begin
MB := MetabaseClass.Active;
DimenObj := MB.ItemById("D_TO").Edit;
Dimen := DimenObj.Open(Null) As IDimInstance;
// Create an object containing dictionary selection
Selection := Dimen.CreateSelection;
// Work with XML file
XMLDoc := New DOMDocument60.Create;
XMLDoc.Load(XMLName);
XMLElem := XMLDoc.selectSingleNode("Root") As IXMLDOMElement;
// Load selection from XML file
Selection.Load(XMLElem);
// Apply loaded selection schema
Selection.ApplySelectionSchemaOnlyOnce := True;
// Save dictionary
DimenObj.Save;
End Sub UserProc;
After executing the example the selection schema loaded from XML file is applied on dictionary opening.
See also: