To export data to a database, carry out the steps below:
|1.||Use a DatabaseConnection object and set the necessary properties.|
All properties except SQLSelect are important for the export. ADOConnection or File defines the target for the output. You need to set only one of them.
|2.||Fill an ExportSettings object with the required values.|
These properties are the same options as those available in the export dialog of XMLSpy. Select the menu option Convert | Export to Text files/Database to see the options and try a combination of export settings. After that it is easy to transfer these settings to the properties of the interface.
Call Application.GetExportSettings to get an ExportSettings object:
objExpSettings = objSpy.GetExportSettings()
|3.||Build an element list with Document.GetExportElementList.|
The element list enables you to eliminate XML elements from the export process. It also gives you information about the record and field count in the RecordCount and FieldCount properties. Set the ExportSettings.ElementList property to this collection. It is possible to set the element list to null/Nothing (default) to export all elements.
|4.||Call Document.ExportToDatabase to execute the export.|
The description of the ExportToDatabase method contains also a code example for a database export.
// set the behaviour of the export with ExportSettings
The JScript code listed above is available in the sample file ImportExport.js (see Example Files).
(C) 2018 Altova GmbH