SaveToXml: String
SaveToXml(): string
The SaveToXml method saves a workspace state to XML.
The method returns XML file contents as a string. Later, the obtained content can be saved to the file using the XML assembly resources. The XML contents is also used by the LoadFromXml method to load workspace state.
Executing the example requires a workspace with the WSP identifier in repository.
Add links to the Andy, Metabase, XML system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Wsp: IWxWorkspace;
XMLDoc: FreeThreadedDOMDocument60;
Begin
Mb := MetabaseClass.Active;
Wsp := Mb.ItemById("WSP").Bind As IWxWorkspace;
XMLDoc := New FreeThreadedDOMDocument60.Create;
XMLDoc.loadXML(Wsp.SaveToXml);
XMLDoc.save("d:\WorkspaceState.xml");
End Sub UserProc;
Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.MsXml2;
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
Wsp: IWxWorkspace;
XMLDoc: FreeThreadedDOMDocument60 = New FreeThreadedDOMDocument60Class();
Begin
Mb := Params.Metabase;
Wsp := Mb.ItemById["WSP"].Bind() As IWxWorkspace;
XMLDoc.loadXML(Wsp.SaveToXml());
XMLDoc.save("d:\WorkspaceState.xml");
End Sub;
On executing the example, the current workspace state will be saved to the specified XML file.
See also: