SaveToXml(Writer: Variant);
SaveToXml(Writer: Object);
Writer. XML element to which search service parameters are saved.
The SaveToXml method saves settings of the search service to the selected XML element.
As the Writer parameter it is necessary to determine XML element described by the IXmlDomElement interface. The specified element must be created and included to the structure of the XML document to which settings will be saved.
Connect the BISearch, Metabase, XML system assemblies.
Sub UserProc;
Var
MB: IMetabase;
SearchFactory: ISearchEngineServiceFactory;
SearchEngine: ISearchEngineServiceBase;
XMLDoc: IXMLDOMDocument3;
XMLElement: IXmlDomElement;
Begin
MB := MetabaseClass.Active;
SearchFactory := New SearchEngineServiceFactory.Create;
SearchEngine := SearchFactory.CreateSearchEngine(MB);
//...
//Set up search platform settings
//...
//Create a new XML document
XMLDoc := New DOMDocument60.Create;
//Create root node
XMLElement := XMLDoc.createElement("Search");
XMLDoc.appendChild(XMLElement);
//Save settings to the file
SearchEngine.SaveToXml(XMLElement);
XMLDoc.save("c:\SearchEngine.xml");
End Sub UserProc;
On executing the example an object that gives access to the search service is created. After set up, the settings will be saved to the SearchEngine.xml file.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.BISearch;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.MsXml2;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
SearchFactory: SearchEngineServiceFactory = New SearchEngineServiceFactoryClass();
SearchEngine: ISearchEngineServiceBase;
XMLDoc: IXMLDOMDocument3;
XMLElement: IXmlDomElement;
Begin
MB := Params.Metabase;
SearchEngine := SearchFactory.CreateSearchEngine(MB);
//...
//Set up search platform settings
//...
//Create a new XML document
XMLDoc := New DOMDocument60();
//Create root node
XMLElement := XMLDoc.createElement("Search");
XMLDoc.appendChild(XMLElement);
//Save settings to the file
SearchEngine.SaveToXml(XMLElement);
XMLDoc.save("c:\SearchEngine.xml");
End Sub;
See also: