beautypg.com

Serialization of the data – Kofax DOKuStar Validation User Manual

Page 101

background image

DOKuStar Validation Programming Manual

Page

97

Serialization of the Data

The Data object can be exported into/imported from a file. To achieve this, there are special Importer and Exporter
objects. Example:

Sub ImportData(App As Application, filename As String)
Dim ie As Importer
Set ie = App.CreateObject("dataset::DataImporter")
ie.Import filename, App.Project.dataset
Set ie = Nothing
End Sub

Sub ExportData(App As Application, filename As String)
Dim de As Exporter
Set de = App.CreateObject("dataset::DataExporter")
de.ExportData filename, App.Project.dataset
Set de = Nothing
End Sub

As you can see from the example, the following is done:

-

Define a variable of type

Importer,

or

Exporter

respectively

- Use

the

App.CreateObject

method with the parameter

“dataset::DataImporter”,

or

“dataset::DataExporter

” respectively (these are fixed keywords), and assign it to the variable.

- Call

its

method

Import

, or

Export

respectively, which takes a file name and the dataset object as parameter.

Note that the

Export

method will not erase the data from the dataset; if you want this to be done, use the

Clear

method of the

Data

object. Likewise, the

Import

will add data to any existing data in the dataset, set you might

want to clear the existing data beforehand.

The format of the file is an internal XML format. It is not intended to be interpreted be any other program.